From 236d27d962641939588ae793f29e580a48f68d35 Mon Sep 17 00:00:00 2001 From: "Marc J. Szalkiewicz" Date: Thu, 26 May 2016 21:12:32 -0400 Subject: [PATCH 1/6] Use a function syntax compatible with OpenBSD pdksh in the git wrapper. --- commands/inits/data/git_wrapper.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commands/inits/data/git_wrapper.sh b/commands/inits/data/git_wrapper.sh index c795c94..094ac88 100644 --- a/commands/inits/data/git_wrapper.sh +++ b/commands/inits/data/git_wrapper.sh @@ -8,7 +8,7 @@ export SCMPUFF_GIT_CMD="$(\which git)" # Wrap git with the 'hub' github wrapper, if installed if type hub > /dev/null 2>&1; then export SCMPUFF_GIT_CMD="hub"; fi -function git() { +git() { case $1 in commit|blame|log|rebase|merge) eval "$(scmpuff expand -- "$SCMPUFF_GIT_CMD" "$@")";; From ddc6bbbc27d9f8a578d15fa23bf4af5f5b8da62a Mon Sep 17 00:00:00 2001 From: "Marc J. Szalkiewicz" Date: Thu, 26 May 2016 21:13:33 -0400 Subject: [PATCH 2/6] Use a POSIX-compliant loop syntax for unsetting environment variables. --- commands/inits/data/status_shortcuts.sh | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/commands/inits/data/status_shortcuts.sh b/commands/inits/data/status_shortcuts.sh index d22f6e9..c4ccd6a 100644 --- a/commands/inits/data/status_shortcuts.sh +++ b/commands/inits/data/status_shortcuts.sh @@ -40,14 +40,11 @@ scmpuff_status() { # Clear numbered env variables scmpuff_clear_vars() { local scmpuff_env_char="e" - local i - - for (( i=1; i<=999; i++ )); do - local env_var_i=${scmpuff_env_char}${i} - if [[ -n ${env_var_i} ]]; then - unset ${env_var_i} - else - break - fi + local i=0 + local env_var_i=${scmpuff_env_char}${i} + + until [ "${env_var_i+is_null}" ]; do + unset ${env_var_i} + env_var_i=${scmpuff_env_char}$(( ++i )) done } From 7745876cf5922374fd4b7ce04c8c8bb8012da9cd Mon Sep 17 00:00:00 2001 From: "Marc J. Szalkiewicz" Date: Thu, 26 May 2016 21:15:20 -0400 Subject: [PATCH 3/6] Use a literal tab character for shells not supporting ANSI C Quoting (e.g. OpenBSD pdksh). Do not assume the value of the IFS when restoring. --- commands/inits/data/status_shortcuts.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/commands/inits/data/status_shortcuts.sh b/commands/inits/data/status_shortcuts.sh index c4ccd6a..998ddf6 100644 --- a/commands/inits/data/status_shortcuts.sh +++ b/commands/inits/data/status_shortcuts.sh @@ -21,13 +21,16 @@ scmpuff_status() { # Export numbered env variables for each file scmpuff_clear_vars - IFS=$'\t' + IFS_CUR=$IFS + # Some shells (pdksh) do not support ANSI C Quoting, i.e. $'\t' + # This temporary IFS is a literal tab character, not a space. + IFS=' ' local e=1 for file in $files; do export $scmpuff_env_char$e="$file" let e++ done - IFS=$' \t\n' + IFS=$IFS_CUR # Print status (from line two onward) echo "$cmd_output" | tail -n +2 From 3822583d78c350427c1a3012ace2af5b3b86c843 Mon Sep 17 00:00:00 2001 From: "Marc J. Szalkiewicz" Date: Thu, 26 May 2016 21:15:39 -0400 Subject: [PATCH 4/6] bindata updated for OpenBSD pdksh compatibility. --- commands/inits/bindata.go | 195 ++++++++++++++++++++------------------ 1 file changed, 101 insertions(+), 94 deletions(-) diff --git a/commands/inits/bindata.go b/commands/inits/bindata.go index 24d9328..97f6859 100644 --- a/commands/inits/bindata.go +++ b/commands/inits/bindata.go @@ -1,3 +1,10 @@ +// Code generated by go-bindata. +// sources: +// data/aliases.sh +// data/git_wrapper.sh +// data/status_shortcuts.sh +// DO NOT EDIT! + package inits import ( @@ -5,15 +12,14 @@ import ( "compress/gzip" "fmt" "io" - "strings" - "os" - "time" "io/ioutil" - "path" + "os" "path/filepath" + "strings" + "time" ) -func bindata_read(data []byte, name string) ([]byte, error) { +func bindataRead(data []byte, name string) ([]byte, error) { gz, err := gzip.NewReader(bytes.NewBuffer(data)) if err != nil { return nil, fmt.Errorf("Read %q: %v", name, err) @@ -21,11 +27,14 @@ func bindata_read(data []byte, name string) ([]byte, error) { var buf bytes.Buffer _, err = io.Copy(&buf, gz) - gz.Close() + clErr := gz.Close() if err != nil { return nil, fmt.Errorf("Read %q: %v", name, err) } + if clErr != nil { + return nil, err + } return buf.Bytes(), nil } @@ -35,89 +44,89 @@ type asset struct { info os.FileInfo } -type bindata_file_info struct { - name string - size int64 - mode os.FileMode +type bindataFileInfo struct { + name string + size int64 + mode os.FileMode modTime time.Time } -func (fi bindata_file_info) Name() string { +func (fi bindataFileInfo) Name() string { return fi.name } -func (fi bindata_file_info) Size() int64 { +func (fi bindataFileInfo) Size() int64 { return fi.size } -func (fi bindata_file_info) Mode() os.FileMode { +func (fi bindataFileInfo) Mode() os.FileMode { return fi.mode } -func (fi bindata_file_info) ModTime() time.Time { +func (fi bindataFileInfo) ModTime() time.Time { return fi.modTime } -func (fi bindata_file_info) IsDir() bool { +func (fi bindataFileInfo) IsDir() bool { return false } -func (fi bindata_file_info) Sys() interface{} { +func (fi bindataFileInfo) Sys() interface{} { return nil } -var _data_aliases_sh = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x3c\xc9\x41\x0a\xc4\x20\x0c\x05\xd0\xfd\x9c\xc2\x9d\xa7\xf0\x2c\x43\x48\x8c\x95\x5a\x2c\xfe\x78\xff\x16\x52\xb2\x7d\x8f\x46\x27\xa4\x86\x92\xc1\xd7\xbd\x55\xff\x30\xb2\x8d\xfc\xfb\x86\x4a\x6e\xdd\x12\x89\x04\x89\x93\x74\xd5\xb0\xe1\x36\x66\x0b\xe2\xe9\xc6\x47\xe5\x73\x6e\x8b\x58\xf0\x58\x15\xf5\xd5\x27\x00\x00\xff\xff\xb3\xf6\xf4\x39\x83\x00\x00\x00") +var _dataAliasesSh = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x3c\xc9\x41\x0a\xc4\x20\x0c\x05\xd0\xfd\x9c\xc2\x9d\xa7\xf0\x2c\x43\x48\x8c\x95\x5a\x2c\xfe\x78\xff\x16\x52\xb2\x7d\x8f\x46\x27\xa4\x86\x92\xc1\xd7\xbd\x55\xff\x30\xb2\x8d\xfc\xfb\x86\x4a\x6e\xdd\x12\x89\x04\x89\x93\x74\xd5\xb0\xe1\x36\x66\x0b\xe2\xe9\xc6\x47\xe5\x73\x6e\x8b\x58\xf0\x58\x15\xf5\xd5\x27\x00\x00\xff\xff\xb3\xf6\xf4\x39\x83\x00\x00\x00") -func data_aliases_sh_bytes() ([]byte, error) { - return bindata_read( - _data_aliases_sh, +func dataAliasesShBytes() ([]byte, error) { + return bindataRead( + _dataAliasesSh, "data/aliases.sh", ) } -func data_aliases_sh() (*asset, error) { - bytes, err := data_aliases_sh_bytes() +func dataAliasesSh() (*asset, error) { + bytes, err := dataAliasesShBytes() if err != nil { return nil, err } - info := bindata_file_info{name: "data/aliases.sh", size: 131, mode: os.FileMode(420), modTime: time.Unix(1426541666, 0)} - a := &asset{bytes: bytes, info: info} + info := bindataFileInfo{name: "data/aliases.sh", size: 131, mode: os.FileMode(420), modTime: time.Unix(1426541666, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } -var _data_git_wrapper_sh = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\xa4\x52\x5f\x8b\xda\x40\x10\x7f\xdf\x4f\x31\x44\xa9\xa6\x54\xc4\xbe\x86\x4a\xc1\x62\xe9\x83\x50\xda\x4a\x5f\x0a\xb2\x26\xb3\xc9\xd0\xcd\x6e\xd8\xdd\x44\xe5\x72\xdf\xfd\x66\xa3\xde\x83\x9c\xdc\xc1\x3d\x2d\xf3\xfb\x3b\xa3\x19\xc1\x2f\xac\x6d\x87\x20\xcd\x09\xf0\x48\x3e\x90\x29\xa1\xa4\x00\x52\x93\xf4\x60\x1d\xa8\xd6\xe4\x81\xac\x11\xad\x39\x63\x91\x5d\xc2\xbc\xc0\x6e\x6e\x5a\xad\xe1\xf3\xf2\xc3\x82\x49\x8f\x01\x66\xea\x65\x56\x8c\x60\xeb\x11\x42\x85\x1c\xc7\x60\x23\x43\x05\xc1\x0e\x62\x7e\x64\x67\xa9\x00\x32\x8a\x0c\x05\x04\x6d\x6d\x03\x07\x62\x49\xe4\x9f\xfb\xf1\xd8\x58\x17\xe0\xf7\x6a\xf3\x73\xbb\x5e\xef\xbe\xff\xf8\xb3\x5b\x6d\xbe\x7d\x49\xc6\xd3\x7f\x87\x8a\xf2\x41\x9d\x26\xb1\xeb\xaf\x93\xcd\xe0\x1d\x42\x62\xeb\xa4\x6a\xf7\x93\x08\xf1\x0b\x07\xa6\x1b\x74\x9f\x80\x14\x97\xfa\x20\xb5\xc6\x42\xf0\x10\x4e\x0d\x42\x54\xdc\x1e\x90\xc5\x10\x03\xf7\x36\x60\x4b\x92\x81\x22\x21\xae\xcb\xc6\xaa\x69\x0a\x0f\x02\x20\x97\x7c\xf9\x78\xc1\x4d\x3c\xf0\x68\xeb\x9a\x42\xbf\xd7\xb2\xc6\x5e\xdb\xb2\x77\xb8\x67\x45\x5f\xa3\x2b\x31\x1d\x24\x00\xd8\x49\x0d\x7c\x98\xcf\xeb\xa6\x55\x2a\x16\x4b\x53\xc0\x6c\xc6\xe0\x4d\x7b\xc2\xd0\xd7\x24\x4d\xb2\xec\x1c\x5f\x61\xfe\xdf\xb6\xa1\x2f\x48\xa9\xde\xd5\x1c\xcf\x7f\xcc\xab\xb9\x0e\xb5\x0c\xc4\xdf\xc1\x1b\x2a\x64\x51\xbc\x63\xcf\x8b\xf3\xe2\xd8\xf1\xaf\x1f\x5a\x7f\x49\xfe\x78\xcd\xbd\xe3\x1e\x64\xe8\x65\x2e\x1e\xc5\x53\x00\x00\x00\xff\xff\x93\x56\x0f\x71\xba\x02\x00\x00") +var _dataGit_wrapperSh = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\xa4\x51\x4f\x6b\xdb\x30\x14\xbf\xeb\x53\x3c\x9c\xb0\xc4\x63\x21\x64\x57\xb3\x30\xc8\xc8\xd8\x21\x30\xb6\x85\x5d\x0a\x41\xb1\x9f\xec\x47\x65\xc9\x48\xb2\x93\x50\xf7\xbb\xf7\xc9\x49\x7b\x08\x0d\x2d\xf4\x24\xde\xef\xaf\x9e\x34\x82\x3f\x58\xdb\x0e\x41\x9a\x13\xe0\x91\x7c\x20\x53\x42\x49\x01\xa4\x26\xe9\xc1\x3a\x50\xad\xc9\x03\x59\x23\x5a\x73\xc6\x22\xbb\x84\x79\x81\xdd\xdc\xb4\x5a\xc3\xd7\xe5\xa7\x05\x93\x1e\x03\xcc\xd4\xeb\xac\x18\xc1\xd6\x23\x84\x0a\x39\x8e\xc1\x46\x86\x0a\x82\x1d\xc4\x7c\xc8\xce\x52\x01\x64\x14\x19\x0a\x08\xda\xda\x06\x0e\xc4\x92\xc8\xbf\xf4\xe3\xb1\xb1\x2e\xc0\xdf\xd5\xe6\xf7\x76\xbd\xde\xfd\xfc\xf5\x6f\xb7\xda\xfc\xf8\x96\x8c\xa7\x77\x87\x8a\xf2\x41\x9d\x26\xb1\xeb\xbf\x93\xcd\xe0\x1d\x42\x62\xeb\xa4\x6a\xf7\x93\x08\xf1\x09\x07\xa6\x1b\x74\x5f\x80\x14\x97\xfa\x20\xb5\xc6\x42\xf0\x10\x4e\x0d\x42\x54\x5c\x2f\x90\xc5\x10\x03\xb7\x6e\xc0\x96\x24\x03\x45\x42\x70\xc3\x34\x85\x07\x01\x90\x4b\x5e\x78\xbc\xe0\x02\x1e\x78\xb4\x75\x4d\xa1\xdf\x6b\x59\x63\xaf\x6d\xd9\x3b\xdc\xb3\xa2\xaf\xd1\x95\x98\x0e\x12\x00\xec\xa4\x06\xde\xc7\xe7\x75\xd3\x2a\x15\xfb\xa4\x29\x60\x36\x63\xf0\xaa\x34\x61\xe8\x7b\x92\x26\x59\x76\x8e\xaf\x30\xbf\xb7\x6d\xe8\x0b\x52\xaa\x77\x35\xc7\xf3\x7f\xbc\x99\xeb\x50\xcb\x40\xfc\xfd\xef\xa8\x90\x45\xf1\x81\x7b\x5e\x9c\x17\xc7\x8e\x1f\x3d\xb4\xfe\x92\xfc\xf9\x39\xf7\x86\x7b\x90\xa1\x97\xb9\x78\x14\x4f\x01\x00\x00\xff\xff\x51\x13\x5b\x02\xb1\x02\x00\x00") -func data_git_wrapper_sh_bytes() ([]byte, error) { - return bindata_read( - _data_git_wrapper_sh, +func dataGit_wrapperShBytes() ([]byte, error) { + return bindataRead( + _dataGit_wrapperSh, "data/git_wrapper.sh", ) } -func data_git_wrapper_sh() (*asset, error) { - bytes, err := data_git_wrapper_sh_bytes() +func dataGit_wrapperSh() (*asset, error) { + bytes, err := dataGit_wrapperShBytes() if err != nil { return nil, err } - info := bindata_file_info{name: "data/git_wrapper.sh", size: 698, mode: os.FileMode(420), modTime: time.Unix(1426541666, 0)} - a := &asset{bytes: bytes, info: info} + info := bindataFileInfo{name: "data/git_wrapper.sh", size: 689, mode: os.FileMode(420), modTime: time.Unix(1426541666, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } -var _data_status_shortcuts_sh = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x84\x94\x41\x6f\xd3\x4e\x10\xc5\xef\xfe\x14\xef\xef\x5a\x6a\xa2\xb4\xea\xbf\xdc\xaa\x60\x81\x04\xa9\xe8\x85\xa2\xa4\x70\x80\x56\xe9\xc6\x1e\xd7\x2b\xd6\xbb\xd6\xee\xba\x2e\x84\x7c\x77\x66\xed\x38\x29\x85\xaa\x27\xdb\x99\xd9\x99\xf7\x7e\x33\x1b\x97\x55\x75\x53\x14\x4b\xe7\x85\x6f\xdc\x68\x8c\x75\x04\x28\x93\x09\x85\x21\x44\xfa\x7e\x99\x95\xc2\xa6\x31\xc5\x11\x47\x0f\x30\xd3\xae\xb1\x04\x57\xb6\xc6\xe6\xae\x56\xd2\x43\x3a\x18\x8d\xc2\x58\xfc\x74\x25\x27\xc9\x02\xdf\x70\xac\x11\x27\x5f\x17\x1f\x96\x5f\x66\xf3\xc5\xc5\xe5\xc7\x18\x37\x53\xf8\x92\x34\x1c\x79\x53\xfb\xc7\x15\xa6\x28\xe4\xb4\x2f\x3f\x6f\xf4\xd0\x1c\xbd\xae\x23\x7e\x1a\xee\x68\x1a\x5f\x37\xbe\x4b\x1a\xdd\x76\x2a\x6f\xa1\x89\x72\x07\x6f\xb0\xa2\x20\x41\x7a\x56\xd2\x6a\x28\xa9\xf9\x9b\x9b\xd9\x56\x3a\x02\x3d\xb0\xc8\xcc\xe4\x14\x94\xba\x56\x28\x65\x5a\xca\xff\x1b\xef\xdc\x66\x55\xbe\xdc\x95\xdf\x7f\xa4\x71\x32\x3a\x69\x9c\x3d\x59\x49\x7d\xc2\x24\x9e\x08\xc3\xf1\x71\x21\x15\x29\xe9\x3c\x92\xb7\xe3\x2d\x1f\x36\x1f\x1a\x13\x5a\xe1\x20\x34\xc8\x5a\x63\x8f\x7a\x0d\xb5\xa5\x8a\x4f\x5a\x52\x3f\x8e\x38\x96\xa3\x16\x8e\x93\x94\xd1\x77\xe1\xd0\x5e\x68\xef\x72\x71\xf5\xfe\xf2\xf3\x55\x57\x68\xa7\x1a\xab\xc6\x43\x1b\x0f\x0e\xce\xe6\x73\x86\x63\xd0\x38\xb2\x8c\xd3\x34\x2a\x67\x69\x52\xf1\xf8\x88\xfa\xc6\xa8\xdc\xdd\xde\x27\xb9\x34\x79\x33\x0c\x28\x21\x76\xc0\x9c\xfe\x1f\x06\xc3\x01\xc0\x12\xeb\xd3\x21\xc8\x9f\x85\xec\x3d\x9d\x93\xcf\x4a\x74\x46\x4d\x81\x60\xda\x61\x54\x58\x53\xf1\xbb\xe5\x1f\x7b\xde\xcc\x25\xb3\x92\x27\xdb\xd3\x1b\x77\x05\x38\x35\x60\xa4\xac\x34\xbc\x0f\x7b\xb6\x31\x7e\xa1\x24\x91\x87\x3d\x39\x1d\xd8\xcd\x1e\x6a\x63\xd9\x5e\x53\xad\x98\x60\x8e\xc0\xfc\x5e\x58\x29\x56\xa1\x63\x58\x30\x12\x2c\x24\x54\xe5\xfc\x61\x47\x33\x45\xc2\x2e\x39\x2f\x48\xbe\x38\x5f\xa4\xc9\xe1\xb5\x3f\xdc\x9b\x4e\x4f\x83\x12\x3e\x1c\xce\x41\xb2\xb9\x4e\xd6\x14\xb9\xe9\x2c\x53\xdf\x35\x79\xba\xf3\x09\xb1\xf2\x90\x1a\x77\x69\x8a\x3c\x68\x32\xe1\xf7\xdc\x68\xda\xb5\xc2\xb5\xbf\xd6\x87\xbd\xfe\x4f\x56\x6a\x3f\x6c\x47\x0f\xa8\x43\xe3\x5b\xc3\xeb\xd9\x0a\x9b\x07\x28\xff\x64\xe1\x85\x54\x81\xc5\xe4\xd5\xf6\x1e\x10\x5f\x93\x70\x9f\x02\x04\x69\x8d\xae\x88\x4b\xf3\xa6\xe7\x54\x88\x46\xf9\x97\xaf\x59\xa3\x9f\xbb\x68\x9b\x28\x8a\x0e\xf0\x2e\x60\x7b\x86\x75\xf4\x37\xdb\x97\xff\x1e\x86\x60\xb7\x34\x81\xf7\x68\x04\x99\x9e\x4e\x21\x5f\xa7\x67\x67\x67\xfc\x9c\x4c\x30\x1e\xef\xb8\x6f\xc7\xc3\x25\xb8\xfe\x52\xa6\xc9\xfa\x69\xd9\x4d\xb2\x96\x9b\x2e\x37\x78\xed\xcc\x26\xeb\xdd\x81\x0d\x6e\x1e\x6f\x2e\x7a\xc7\x7f\x64\xf4\xf3\x55\x8e\xb6\x19\x2b\x4b\xe2\x7b\xf7\xce\xab\xbd\x1d\xe4\x26\xfa\x1d\x00\x00\xff\xff\xfa\x9a\x5d\x4e\x08\x05\x00\x00") +var _dataStatus_shortcutsSh = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x84\x54\x5b\x6f\xdb\x3a\x0c\x7e\x3e\xf9\x15\x3c\xae\x81\x24\x48\x7a\x3b\xaf\x81\x71\x36\x74\x29\xd6\x97\x76\x4b\xda\x3d\xec\x02\x57\xb1\xe8\x5a\x98\x2c\x19\xba\xd4\xed\xb2\xfc\xf7\x51\x72\x9c\x14\xdd\xba\x3e\x45\x0a\x29\xf2\xbb\x90\xb6\x45\xdd\xf8\xb2\xcc\xad\x63\xce\xdb\xd1\x18\xd6\x03\x00\xa9\x0b\x26\xa1\x0f\xa1\xba\xcf\x8b\x8a\x99\x2c\xc1\x64\x40\xd1\x03\x98\x2b\xeb\x0d\x82\xad\x5a\x6d\xb8\x6d\xa4\x70\x20\x2c\x68\x05\xa5\x36\xf0\xc3\x56\x94\x24\x4a\xf8\x02\x87\x0a\x92\xf4\xf3\xf2\x7d\xfe\x69\xbe\x58\x5e\x5c\x5d\x26\xf0\x6d\x06\xae\x42\x05\x16\x9d\x6e\xdc\xd3\x0a\x33\x28\xc5\xac\x2b\xbf\xf0\xaa\x6f\x0e\x1d\xae\x29\xfd\x6a\xea\xa8\xbd\x6b\xbc\x8b\x49\xa3\xdb\x88\xf2\x16\x14\x22\xb7\xe0\x34\xac\x30\x40\x10\x8e\x90\xb4\x0a\xa4\x50\x74\xa7\x66\xa6\x15\x16\x01\x1f\x08\x64\xa1\x39\x06\xa4\xb6\x65\x52\xea\x16\xf9\xbf\xe3\x1d\xdb\xa2\xe6\xf9\xae\xfc\xfe\x92\x25\xe9\xe8\xd8\x5b\x73\xbc\x12\xea\x98\x94\x78\x06\x0c\x0e\x0f\x4b\x21\x51\x0a\xeb\x20\x7d\x33\xde\xea\x43\xe4\x43\x63\x84\x96\x59\x60\x0a\xd0\x18\x6d\xa6\x1d\x86\xc6\x60\x4d\x2f\x0d\xca\xc7\x29\xc5\x38\x34\xcc\x52\x92\xd4\xea\x2e\x3c\xda\x03\xed\x58\x2e\xaf\xdf\x5d\xdd\x5c\xc7\x42\x3b\xd4\xb0\xf2\x0e\x94\x76\x40\xc1\xf9\x62\x41\xe2\x68\xf0\x16\x0d\xc9\xa9\xbd\xe4\x04\x4d\x48\xb2\x0f\xb1\x6b\x0c\xb5\xbd\xdb\xf3\x44\x9b\xa5\xff\xf7\x06\xa5\x48\x0c\x48\xa7\x93\xde\x18\x0a\x00\x18\x24\x7c\x2a\x04\xe9\x5a\x8a\x8e\xd3\x39\xba\xa2\x82\x48\x54\x97\x10\x48\x5b\x18\x95\x46\xd7\x74\x36\xf4\x67\xa7\x37\xe9\x52\x18\x41\xce\x76\xea\x8d\x63\x01\x4a\x0d\x32\x62\x51\x69\x9a\x87\xbd\xb6\x09\xfc\x84\x0a\x19\x0f\x73\x72\xda\x6b\x37\x7f\x68\xb4\x21\x7a\xbe\x5e\x91\x82\x1c\x82\xe6\xf7\xcc\x08\xb6\x0a\x1d\xc3\x80\x21\x23\x20\xa1\x2a\xe5\xf7\x33\x5a\x48\x64\x26\xa7\xbc\x00\xf9\xe2\x7c\x99\x9f\xdd\x2c\xb2\x94\x0e\xb1\xe6\x52\xd7\x61\x5a\x51\x4a\xc2\xdc\xf0\xef\xb6\x1a\x03\xd7\x51\x42\xeb\x9b\xd8\xef\xed\xe5\xf2\x02\xce\xe0\xa3\xd7\x4e\xa8\xbb\x29\x88\x23\x3c\x82\x74\xf8\xd5\x0d\x63\x85\xeb\x8a\xc6\xc6\x61\x4d\xb9\xcc\x3c\x86\x0e\x61\x8e\x18\xb1\x76\x68\x48\x55\xc7\x56\x10\x76\x84\x15\x74\x9f\xc6\xca\x0c\x6c\xc3\x0a\xaa\xd2\x21\xca\x86\xff\x0c\x61\xef\x42\x76\x1a\xa4\x21\x36\x81\x08\x08\x52\x3b\xea\x34\x23\x5c\xd1\x03\xec\x64\x48\x9f\x2f\x61\x8a\x24\x65\x48\x4d\x62\x9a\x44\x07\x38\x99\xd0\x99\x6b\x85\xdb\x4e\xe9\x56\x80\x4e\xd0\x0f\x46\x28\xd7\x8f\x6b\xe7\x58\xf4\xca\xb5\x9a\xf6\xa5\x65\x86\x07\x97\xfe\x68\x8e\x63\x42\x06\x73\x26\xff\x6d\x17\x13\x69\x6f\xc3\x82\x07\x57\x84\xd1\xaa\x46\x2a\x4d\xab\xc7\xb1\x64\x5e\xba\xd7\xf7\xde\xab\x97\x36\x7f\x33\x18\x0c\x0e\xe0\x2c\xf8\xf8\x82\xf9\x83\xdf\xcd\x7e\xfd\x7b\xd5\x07\x45\x76\xb2\x17\x9f\x12\xe8\x75\x2e\xb2\x74\xfd\xfc\xd1\x26\x5d\x8b\x4d\x60\xeb\x15\x6d\x11\x71\x49\xd2\xf5\x2e\x7f\x22\x6c\xae\xbc\x94\x9b\x48\x68\xeb\x54\xa4\x04\x4f\xb2\x36\x9d\x81\x7f\x6d\x32\x1a\xc1\x64\x22\x60\x3c\xee\x9d\xdb\x0c\x7e\x05\x00\x00\xff\xff\xb7\xd9\x36\x51\x8a\x05\x00\x00") -func data_status_shortcuts_sh_bytes() ([]byte, error) { - return bindata_read( - _data_status_shortcuts_sh, +func dataStatus_shortcutsShBytes() ([]byte, error) { + return bindataRead( + _dataStatus_shortcutsSh, "data/status_shortcuts.sh", ) } -func data_status_shortcuts_sh() (*asset, error) { - bytes, err := data_status_shortcuts_sh_bytes() +func dataStatus_shortcutsSh() (*asset, error) { + bytes, err := dataStatus_shortcutsShBytes() if err != nil { return nil, err } - info := bindata_file_info{name: "data/status_shortcuts.sh", size: 1288, mode: os.FileMode(420), modTime: time.Unix(1426541666, 0)} - a := &asset{bytes: bytes, info: info} + info := bindataFileInfo{name: "data/status_shortcuts.sh", size: 1418, mode: os.FileMode(420), modTime: time.Unix(1426541666, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -140,7 +149,7 @@ func Asset(name string) ([]byte, error) { // It simplifies safe initialization of global variables. func MustAsset(name string) []byte { a, err := Asset(name) - if (err != nil) { + if err != nil { panic("asset: Asset(" + name + "): " + err.Error()) } @@ -173,9 +182,9 @@ func AssetNames() []string { // _bindata is a table, holding each asset generator, mapped to its name. var _bindata = map[string]func() (*asset, error){ - "data/aliases.sh": data_aliases_sh, - "data/git_wrapper.sh": data_git_wrapper_sh, - "data/status_shortcuts.sh": data_status_shortcuts_sh, + "data/aliases.sh": dataAliasesSh, + "data/git_wrapper.sh": dataGit_wrapperSh, + "data/status_shortcuts.sh": dataStatus_shortcutsSh, } // AssetDir returns the file names below a certain @@ -207,70 +216,68 @@ func AssetDir(name string) ([]string, error) { return nil, fmt.Errorf("Asset %s not found", name) } rv := make([]string, 0, len(node.Children)) - for name := range node.Children { - rv = append(rv, name) + for childName := range node.Children { + rv = append(rv, childName) } return rv, nil } -type _bintree_t struct { - Func func() (*asset, error) - Children map[string]*_bintree_t +type bintree struct { + Func func() (*asset, error) + Children map[string]*bintree } -var _bintree = &_bintree_t{nil, map[string]*_bintree_t{ - "data": &_bintree_t{nil, map[string]*_bintree_t{ - "aliases.sh": &_bintree_t{data_aliases_sh, map[string]*_bintree_t{ - }}, - "git_wrapper.sh": &_bintree_t{data_git_wrapper_sh, map[string]*_bintree_t{ - }}, - "status_shortcuts.sh": &_bintree_t{data_status_shortcuts_sh, map[string]*_bintree_t{ - }}, +var _bintree = &bintree{nil, map[string]*bintree{ + "data": &bintree{nil, map[string]*bintree{ + "aliases.sh": &bintree{dataAliasesSh, map[string]*bintree{}}, + "git_wrapper.sh": &bintree{dataGit_wrapperSh, map[string]*bintree{}}, + "status_shortcuts.sh": &bintree{dataStatus_shortcutsSh, map[string]*bintree{}}, }}, }} -// Restore an asset under the given directory +// RestoreAsset restores an asset under the given directory func RestoreAsset(dir, name string) error { - data, err := Asset(name) - if err != nil { - return err - } - info, err := AssetInfo(name) - if err != nil { - return err - } - err = os.MkdirAll(_filePath(dir, path.Dir(name)), os.FileMode(0755)) - if err != nil { - return err - } - err = ioutil.WriteFile(_filePath(dir, name), data, info.Mode()) - if err != nil { - return err - } - err = os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime()) - if err != nil { - return err - } - return nil + data, err := Asset(name) + if err != nil { + return err + } + info, err := AssetInfo(name) + if err != nil { + return err + } + err = os.MkdirAll(_filePath(dir, filepath.Dir(name)), os.FileMode(0755)) + if err != nil { + return err + } + err = ioutil.WriteFile(_filePath(dir, name), data, info.Mode()) + if err != nil { + return err + } + err = os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime()) + if err != nil { + return err + } + return nil } -// Restore assets under the given directory recursively +// RestoreAssets restores an asset under the given directory recursively func RestoreAssets(dir, name string) error { - children, err := AssetDir(name) - if err != nil { // File - return RestoreAsset(dir, name) - } else { // Dir - for _, child := range children { - err = RestoreAssets(dir, path.Join(name, child)) - if err != nil { - return err - } - } - } - return nil + children, err := AssetDir(name) + // File + if err != nil { + return RestoreAsset(dir, name) + } + // Dir + for _, child := range children { + err = RestoreAssets(dir, filepath.Join(name, child)) + if err != nil { + return err + } + } + return nil } func _filePath(dir, name string) string { - cannonicalName := strings.Replace(name, "\\", "/", -1) - return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...) + cannonicalName := strings.Replace(name, "\\", "/", -1) + return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...) } From f76255fc1e99d7e6ab2265bde1f60cf2a31a81fc Mon Sep 17 00:00:00 2001 From: "Marc J. Szalkiewicz" Date: Thu, 26 May 2016 21:51:32 -0400 Subject: [PATCH 5/6] Update integration test for git wrapper. --- features/command_init.feature | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features/command_init.feature b/features/command_init.feature index f12e024..9689d4b 100644 --- a/features/command_init.feature +++ b/features/command_init.feature @@ -21,7 +21,7 @@ Feature: init command Scenario Outline: --wrap controls git cmd wrapping in output (default: yes) When I successfully run `scmpuff init ` - Then the output contain "function git()" + Then the output contain "git()" Examples: | flags | should? | | -s | should | From 5d44b6c19c290c09d2bd288416f6a66fe2aded97 Mon Sep 17 00:00:00 2001 From: "Marc J. Szalkiewicz" Date: Fri, 27 May 2016 00:06:14 -0400 Subject: [PATCH 6/6] Ensure variables are erased on re-run. --- commands/inits/bindata.go | 4 ++-- commands/inits/data/status_shortcuts.sh | 11 +++-------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/commands/inits/bindata.go b/commands/inits/bindata.go index 97f6859..2a4ba68 100644 --- a/commands/inits/bindata.go +++ b/commands/inits/bindata.go @@ -110,7 +110,7 @@ func dataGit_wrapperSh() (*asset, error) { return a, nil } -var _dataStatus_shortcutsSh = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x84\x54\x5b\x6f\xdb\x3a\x0c\x7e\x3e\xf9\x15\x3c\xae\x81\x24\x48\x7a\x3b\xaf\x81\x71\x36\x74\x29\xd6\x97\x76\x4b\xda\x3d\xec\x02\x57\xb1\xe8\x5a\x98\x2c\x19\xba\xd4\xed\xb2\xfc\xf7\x51\x72\x9c\x14\xdd\xba\x3e\x45\x0a\x29\xf2\xbb\x90\xb6\x45\xdd\xf8\xb2\xcc\xad\x63\xce\xdb\xd1\x18\xd6\x03\x00\xa9\x0b\x26\xa1\x0f\xa1\xba\xcf\x8b\x8a\x99\x2c\xc1\x64\x40\xd1\x03\x98\x2b\xeb\x0d\x82\xad\x5a\x6d\xb8\x6d\xa4\x70\x20\x2c\x68\x05\xa5\x36\xf0\xc3\x56\x94\x24\x4a\xf8\x02\x87\x0a\x92\xf4\xf3\xf2\x7d\xfe\x69\xbe\x58\x5e\x5c\x5d\x26\xf0\x6d\x06\xae\x42\x05\x16\x9d\x6e\xdc\xd3\x0a\x33\x28\xc5\xac\x2b\xbf\xf0\xaa\x6f\x0e\x1d\xae\x29\xfd\x6a\xea\xa8\xbd\x6b\xbc\x8b\x49\xa3\xdb\x88\xf2\x16\x14\x22\xb7\xe0\x34\xac\x30\x40\x10\x8e\x90\xb4\x0a\xa4\x50\x74\xa7\x66\xa6\x15\x16\x01\x1f\x08\x64\xa1\x39\x06\xa4\xb6\x65\x52\xea\x16\xf9\xbf\xe3\x1d\xdb\xa2\xe6\xf9\xae\xfc\xfe\x92\x25\xe9\xe8\xd8\x5b\x73\xbc\x12\xea\x98\x94\x78\x06\x0c\x0e\x0f\x4b\x21\x51\x0a\xeb\x20\x7d\x33\xde\xea\x43\xe4\x43\x63\x84\x96\x59\x60\x0a\xd0\x18\x6d\xa6\x1d\x86\xc6\x60\x4d\x2f\x0d\xca\xc7\x29\xc5\x38\x34\xcc\x52\x92\xd4\xea\x2e\x3c\xda\x03\xed\x58\x2e\xaf\xdf\x5d\xdd\x5c\xc7\x42\x3b\xd4\xb0\xf2\x0e\x94\x76\x40\xc1\xf9\x62\x41\xe2\x68\xf0\x16\x0d\xc9\xa9\xbd\xe4\x04\x4d\x48\xb2\x0f\xb1\x6b\x0c\xb5\xbd\xdb\xf3\x44\x9b\xa5\xff\xf7\x06\xa5\x48\x0c\x48\xa7\x93\xde\x18\x0a\x00\x18\x24\x7c\x2a\x04\xe9\x5a\x8a\x8e\xd3\x39\xba\xa2\x82\x48\x54\x97\x10\x48\x5b\x18\x95\x46\xd7\x74\x36\xf4\x67\xa7\x37\xe9\x52\x18\x41\xce\x76\xea\x8d\x63\x01\x4a\x0d\x32\x62\x51\x69\x9a\x87\xbd\xb6\x09\xfc\x84\x0a\x19\x0f\x73\x72\xda\x6b\x37\x7f\x68\xb4\x21\x7a\xbe\x5e\x91\x82\x1c\x82\xe6\xf7\xcc\x08\xb6\x0a\x1d\xc3\x80\x21\x23\x20\xa1\x2a\xe5\xf7\x33\x5a\x48\x64\x26\xa7\xbc\x00\xf9\xe2\x7c\x99\x9f\xdd\x2c\xb2\x94\x0e\xb1\xe6\x52\xd7\x61\x5a\x51\x4a\xc2\xdc\xf0\xef\xb6\x1a\x03\xd7\x51\x42\xeb\x9b\xd8\xef\xed\xe5\xf2\x02\xce\xe0\xa3\xd7\x4e\xa8\xbb\x29\x88\x23\x3c\x82\x74\xf8\xd5\x0d\x63\x85\xeb\x8a\xc6\xc6\x61\x4d\xb9\xcc\x3c\x86\x0e\x61\x8e\x18\xb1\x76\x68\x48\x55\xc7\x56\x10\x76\x84\x15\x74\x9f\xc6\xca\x0c\x6c\xc3\x0a\xaa\xd2\x21\xca\x86\xff\x0c\x61\xef\x42\x76\x1a\xa4\x21\x36\x81\x08\x08\x52\x3b\xea\x34\x23\x5c\xd1\x03\xec\x64\x48\x9f\x2f\x61\x8a\x24\x65\x48\x4d\x62\x9a\x44\x07\x38\x99\xd0\x99\x6b\x85\xdb\x4e\xe9\x56\x80\x4e\xd0\x0f\x46\x28\xd7\x8f\x6b\xe7\x58\xf4\xca\xb5\x9a\xf6\xa5\x65\x86\x07\x97\xfe\x68\x8e\x63\x42\x06\x73\x26\xff\x6d\x17\x13\x69\x6f\xc3\x82\x07\x57\x84\xd1\xaa\x46\x2a\x4d\xab\xc7\xb1\x64\x5e\xba\xd7\xf7\xde\xab\x97\x36\x7f\x33\x18\x0c\x0e\xe0\x2c\xf8\xf8\x82\xf9\x83\xdf\xcd\x7e\xfd\x7b\xd5\x07\x45\x76\xb2\x17\x9f\x12\xe8\x75\x2e\xb2\x74\xfd\xfc\xd1\x26\x5d\x8b\x4d\x60\xeb\x15\x6d\x11\x71\x49\xd2\xf5\x2e\x7f\x22\x6c\xae\xbc\x94\x9b\x48\x68\xeb\x54\xa4\x04\x4f\xb2\x36\x9d\x81\x7f\x6d\x32\x1a\xc1\x64\x22\x60\x3c\xee\x9d\xdb\x0c\x7e\x05\x00\x00\xff\xff\xb7\xd9\x36\x51\x8a\x05\x00\x00") +var _dataStatus_shortcutsSh = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x84\x94\xdf\x52\xdb\x3a\x10\xc6\xaf\x4f\x9e\x62\x4f\xf0\x4c\x12\x48\x80\x9c\xbb\x33\x19\x4f\xdb\xa1\x61\xca\x0d\xb4\x09\xf4\xa2\x84\x1a\xc5\x5a\x63\x4d\x65\xc9\xa3\x3f\x31\xb4\xf0\xee\x5d\xc9\x31\xe9\xd0\x32\xbd\x49\xac\x68\xbd\xfb\xed\xef\xdb\x8d\xcd\xab\xda\x17\x45\x66\x1d\x73\xde\x0e\x47\xf0\xa3\x07\x20\x75\xce\x24\x74\x57\xa8\x36\x59\x5e\x32\x93\xf6\xb1\xdf\xa3\xdb\x3d\x98\x2b\xeb\x0d\x82\x2d\x1b\x6d\xb8\xad\xa5\x70\x20\x2c\x68\x05\x85\x36\xf0\xdd\x96\x14\x24\x0a\xb8\x86\x89\x82\x7e\xf2\x65\xf9\x21\xfb\x3c\x5f\x2c\xcf\x2e\xce\xfb\x70\x33\x03\x57\xa2\x02\x8b\x4e\xd7\xee\xd7\x0c\x33\x28\xc4\xac\x4d\xbf\xf0\xaa\x2b\x0e\xad\xae\x31\x7d\x6b\xaa\xa8\xbd\xab\xbd\x8b\x41\xc3\xdb\xa8\xf2\x16\x14\x22\xb7\xe0\x34\xac\x31\x48\x10\x8e\x94\x34\x0a\xa4\x50\x74\xa6\x62\xa6\x11\x16\x01\xef\x49\x64\xae\x39\x06\xa5\xb6\x61\x52\xea\x06\xf9\xbf\xa3\xe7\x6e\xf3\x8a\x67\xcf\xe9\x77\x87\xb4\x9f\x0c\x8f\xbc\x35\x47\x6b\xa1\x8e\x88\xc4\x0b\x61\x30\x99\x14\x42\xa2\x14\xd6\x41\xf2\x76\xb4\xe5\x43\xcd\x87\xc2\x08\x0d\xb3\xc0\x14\xa0\x31\xda\x8c\x5b\x0d\xb5\xc1\x8a\xde\x34\x28\x1f\xc6\x74\xc7\xa1\x66\x96\x82\xa4\x56\x77\xe1\xa5\x9d\xd0\xb6\xcb\xe5\xe5\xfb\x8b\xab\xcb\x98\xe8\x59\x35\xac\xbd\x03\xa5\x1d\xd0\xe5\x7c\xb1\x20\x38\x1a\xbc\x45\x43\x38\xb5\x97\x9c\xa4\x09\x49\xf6\x21\xb6\x85\xa1\xb2\x77\xbb\x3e\xd1\xa6\xc9\x9b\xce\xa0\x04\xa9\x03\xe2\x74\xdc\x19\x43\x17\x00\x06\x49\x9f\x0a\x97\x74\x2c\x44\xdb\xd3\x29\xba\xbc\x84\xd8\xa8\x2e\x20\x34\x6d\x61\x58\x18\x5d\xd1\xb3\xa1\x1f\x5b\xde\xc4\x25\x37\x82\x9c\x6d\xe9\x8d\x62\x02\x0a\x0d\x18\x31\x2f\x35\xcd\xc3\x8e\x6d\x1f\x1e\xa1\x44\xc6\xc3\x9c\x4c\x3b\x76\xf3\xfb\x5a\x1b\x6a\xcf\x57\x6b\x22\xc8\x21\x30\xdf\x30\x23\xd8\x3a\x54\x0c\x03\x86\x8c\x84\x84\xac\x14\xdf\xcd\x68\x2e\x91\x99\x8c\xe2\x82\xe4\xb3\xd3\x65\x76\x72\xb5\x48\x13\x7a\x88\x39\x97\xba\x0a\xd3\x8a\x52\x92\xe6\x9a\x7f\xb3\xe5\x08\xb8\x8e\x08\xad\xaf\x63\xbd\x77\xe7\xcb\x33\x38\x81\x4f\x5e\x3b\xa1\xee\xc6\x20\x0e\xf1\x10\x92\xc1\xca\x0d\x62\x86\xcb\x92\xc6\xc6\x61\x45\xb1\xcc\x3c\x84\x0a\x61\x8e\x18\x75\xed\xd0\x10\x55\xc7\xd6\x10\x76\x84\xe5\x74\x1e\xc7\xcc\x0c\x6c\xcd\x72\xca\xd2\x2a\x4a\x07\xff\x0c\x60\xe7\x42\x3a\x0d\x68\xa8\x9b\xd0\x08\x08\xa2\x1d\x39\xcd\x48\x57\xf4\x00\x5b\x0c\xc9\xcb\x25\x4c\x90\x50\x86\xd0\x7e\x0c\x93\xe8\x00\x0f\x0e\xe8\x99\x6b\x85\xdb\x4a\xc9\x16\x40\x0b\xf4\xa3\x11\xca\x75\xe3\xda\x3a\x16\xbd\x72\x8d\xa6\x7d\x69\x98\xe1\xc1\xa5\x3f\x9a\xe3\x98\x90\xc1\x9c\x83\xff\xb6\x8b\x89\xb4\xb7\x61\xc1\x83\x2b\xc2\x68\x55\x21\xa5\xa6\xd5\xe3\x58\x30\x2f\xdd\xdf\xf7\xde\xab\xd7\x36\xff\xa9\xd7\xdb\x83\x93\x60\xe3\x2b\xde\xf7\x7e\xf7\x7a\xfb\x77\x15\x30\x6e\x22\xc3\x61\xd0\xf7\x48\xa3\x1f\x67\x6a\x60\xb3\xaf\xab\x21\x5e\x4f\x27\xff\xdf\x5c\x1f\xd3\xc7\xfe\x6a\x94\x1e\xee\x67\xab\x69\x56\x0f\x46\x91\x59\x84\x18\x45\x41\xb2\xe9\x28\x3e\xf5\x7e\x06\x00\x00\xff\xff\x4c\xe8\x1d\x90\x16\x05\x00\x00") func dataStatus_shortcutsShBytes() ([]byte, error) { return bindataRead( @@ -125,7 +125,7 @@ func dataStatus_shortcutsSh() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "data/status_shortcuts.sh", size: 1418, mode: os.FileMode(420), modTime: time.Unix(1426541666, 0)} + info := bindataFileInfo{name: "data/status_shortcuts.sh", size: 1302, mode: os.FileMode(420), modTime: time.Unix(1426541666, 0)} a := &asset{bytes: bytes, info: info} return a, nil } diff --git a/commands/inits/data/status_shortcuts.sh b/commands/inits/data/status_shortcuts.sh index 998ddf6..9fa7301 100644 --- a/commands/inits/data/status_shortcuts.sh +++ b/commands/inits/data/status_shortcuts.sh @@ -39,15 +39,10 @@ scmpuff_status() { if [ -n "$ZSH_VERSION" ]; then unsetopt shwordsplit; fi; } - # Clear numbered env variables scmpuff_clear_vars() { - local scmpuff_env_char="e" - local i=0 - local env_var_i=${scmpuff_env_char}${i} - - until [ "${env_var_i+is_null}" ]; do - unset ${env_var_i} - env_var_i=${scmpuff_env_char}$(( ++i )) + for v in $(set | sed -n 's_^\(e[1-9][0-9]*\)=.*_\1_p') + do + unset $v done }