Skip to content

Commit

Permalink
[release] Version 2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Kamontat Chantrachirathumrong committed Aug 15, 2018
1 parent 9f7251e commit 39fc011
Show file tree
Hide file tree
Showing 8 changed files with 116 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .gitgo/config.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: 1
version: 2
log: true
commit:
message: false
2 changes: 1 addition & 1 deletion .gitgo/list.yaml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version: 1
version: 2
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -150,5 +150,6 @@ tags

### Go compiled ###
gitgo
build

# End of https://www.gitignore.io/api/emacs,go,godot,linux,macos,vim,visualstudiocode
106 changes: 106 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
#!/usr/bin/env bash
# shellcheck disable=SC1000

# generate by v3.0.2
# link (https://github.com/Template-generator/script-genrating/tree/v3.0.2)

# set -x #DEBUG - Display commands and their arguments as they are executed.
# set -v #VERBOSE - Display shell input lines as they are read.
# set -n #EVALUATE - Check syntax of the script but don't execute.

#/ -----------------------------------
#/ Description: ...
#/ How to: ...
#/ ...
#/ Option: --help | -h | -? | help | h | ?
#/ > show this message
#/ --version | -v | version | v
#/ > show command version
#/ -----------------------------------
#/ Create by: Kamontat Chantrachirathunrong <kamontat.c@hotmail.com>
#/ Since: 16/08/2018
#/ -----------------------------------
#/ Error code 1 -- error
#/ -----------------------------------
#/ Known bug: ...
#/ -----------------------------------
#// Version: 0.0.1 -- description
#// 0.0.2b1 -- beta-format
#// 0.0.2a1 -- alpha-format

export APPNAME="gitgo"

mkdir ./build/ &>/dev/null

process() {
local cmd="$1"
local title="$2"
shift 2
IFS=" " read -r -a array <<<"$@"
duration=$#

curr_bar=0
for ((elapsed = 1; elapsed <= duration; elapsed++)); do
barsize=$(($(tput cols) - 17))
unity=$((barsize / duration))
increment=$((barsize % duration))
skip=$((duration / (duration - increment)))
# Elapsed
((curr_bar += unity))

if [[ $increment -ne 0 ]]; then
if [[ $skip -eq 1 ]]; then
[[ $((elapsed % (duration / increment))) -eq 0 ]] && ((curr_bar++))
else
[[ $((elapsed % skip)) -ne 0 ]] && ((curr_bar++))
fi
fi

[[ $elapsed -eq 1 && $increment -eq 1 && $skip -ne 1 ]] && ((curr_bar++))
[[ $((barsize - curr_bar)) -eq 1 ]] && ((curr_bar++))
[[ $curr_bar -lt $barsize ]] || curr_bar=$barsize

printf "%-7s |" "$title"

# Exection
"$cmd" "${array[elapsed - 1]}"

# Progress
for ((filled = 0; filled <= curr_bar; filled++)); do
printf "#"
done

# Remaining
for ((remain = curr_bar; remain < barsize; remain++)); do
printf " "
done

# Percentage
printf "| %s%%" $(((elapsed * 100) / duration))

# Return
printf '\r'
done
echo
}

build() {
local input="${1}"
local os="${input%%,*}"
local arch="${input##*,}"
local ext=".sh"

[[ "$os" == "windows" ]] && ext=".exe"
[[ "$os" == "darwin" ]] && ext=".sh"

local filename="./build/${APPNAME}.${os}.${arch}${ext}"
env GOOS="$os" GOARCH="$arch" go build -o "$filename" &>/dev/null
}

process build "MacOS" "darwin,386" "darwin,amd64"

process build "Window" "windows,386" "windows,amd64"

process build "Linux" "linux,386" "linux,amd64" "linux,arm" "linux,arm64" "solaris,amd64"

process build "bsd" "openbsd,386" "openbsd,amd64" "openbsd,arm" "freebsd,386" "freebsd,amd64" "freebsd,arm" "netbsd,386" "netbsd,amd64" "netbsd,arm"
2 changes: 1 addition & 1 deletion cmd/commit.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import (
var commitCmd = &cobra.Command{
Use: "commit",
Aliases: []string{"c"},
Short: "commit [-a <files>|--add <files>] [-A|--all]",
Short: "Git commit with format string",
Long: ``,
Run: func(cmd *cobra.Command, args []string) {
om.Log().ToInfo("commit", "start...")
Expand Down
2 changes: 1 addition & 1 deletion cmd/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ var (
var configCmd = &cobra.Command{
Use: "config",
Aliases: []string{"C", "configuration"},
Short: "config [initial|open]",
Short: "Gitgo configuration",
Long: ``,
Run: func(cmd *cobra.Command, args []string) {
om.Log().ToInfo("config", "start...")
Expand Down
6 changes: 3 additions & 3 deletions cmd/configInitial.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,18 @@ var initialForce bool
var configInitialCmd = &cobra.Command{
Use: "init",
Aliases: []string{"i", "initial"},
Short: "A brief description of your command",
Short: "Create and initial gitgo configuration files",
Long: ``,
Run: func(cmd *cobra.Command, args []string) {
om.Log().ToInfo("config", "initial start...")

yaml := `version: 1
yaml := `version: 2
log: false
commit:
message: false
`

listYaml := `version: 1
listYaml := `version: 2
list:
- key: feature
value: Introducing new features.
Expand Down
9 changes: 2 additions & 7 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,11 @@ var verbose bool
// rootCmd represents the base command when called without any subcommands
var rootCmd = &cobra.Command{
Use: "gitgo",
Short: "gitgo command",
Version: "1.0.0",
Short: "gitgo command by Kamontat Chantrachurathumrong",
Version: "2.0.0",
Long: ``,
// Uncomment the following line if your bare application
// has an action associated with it:
// Run: func(cmd *cobra.Command, args []string) { },
}

// Execute adds all child commands to the root command and sets flags appropriately.
// This is called by main.main(). It only needs to happen once to the rootCmd.
func Execute() {
if err := rootCmd.Execute(); err != nil {
fmt.Println(err)
Expand Down

0 comments on commit 39fc011

Please sign in to comment.