Skip to content
Snippets Groups Projects
Commit 7ee75c01 authored by Richard Hartmann's avatar Richard Hartmann
Browse files

Remove `use` and `exit`

parent 5c2fca9c
No related branches found
No related tags found
No related merge requests found
...@@ -6,12 +6,10 @@ _arguments \ ...@@ -6,12 +6,10 @@ _arguments \
help\:"display help" help\:"display help"
delete\:"delete repo" delete\:"delete repo"
enter\:"Enter repo; spawn new \$SHELL" enter\:"Enter repo; spawn new \$SHELL"
exit\:"Exit repo; unset ENV"
init\:"init & clone from repo" init\:"init & clone from repo"
list\:"list all repos" list\:"list all repos"
run\:"run command on repo" run\:"run command on repo"
seed-gitignore\:"seed .gitignore.d/foo from git ls-files" seed-gitignore\:"seed .gitignore.d/foo from git ls-files"
setup\:"set up repo with recommended settings" setup\:"set up repo with recommended settings"
use\:"Use repo; set ENV"
\<REPO\>\:"Run git command directly" \<REPO\>\:"Run git command directly"
))' ))'
...@@ -9,8 +9,6 @@ vcsh(1) - manage and sync config files via git ...@@ -9,8 +9,6 @@ vcsh(1) - manage and sync config files via git
`vcsh` enter <repo> `vcsh` enter <repo>
`vcsh` exit
`vcsh` help `vcsh` help
`vcsh` init <repo> `vcsh` init <repo>
...@@ -23,8 +21,6 @@ vcsh(1) - manage and sync config files via git ...@@ -23,8 +21,6 @@ vcsh(1) - manage and sync config files via git
`vcsh` setup <repo> `vcsh` setup <repo>
`vcsh` use <repo>
`vcsh` <repo> <gitcommand> `vcsh` <repo> <gitcommand>
...@@ -57,9 +53,6 @@ A sample configuration for `vcsh` and `mr` can be found at ...@@ -57,9 +53,6 @@ A sample configuration for `vcsh` and `mr` can be found at
* enter: * enter:
Enter repository; spawn new <$SHELL>. Enter repository; spawn new <$SHELL>.
* exit:
Exit repository; unset ENV.
* help: * help:
Display help. Display help.
...@@ -79,9 +72,6 @@ A sample configuration for `vcsh` and `mr` can be found at ...@@ -79,9 +72,6 @@ A sample configuration for `vcsh` and `mr` can be found at
* setup: * setup:
Set up repository with recommended settings. Set up repository with recommended settings.
* use:
Use repository; set ENV.
* <repo> <gitcommand>: * <repo> <gitcommand>:
Shortcut to run `vcsh` on a repo. Will prepend `git` to <command> by itself. Shortcut to run `vcsh` on a repo. Will prepend `git` to <command> by itself.
......
...@@ -5,14 +5,6 @@ ...@@ -5,14 +5,6 @@
[ -z "$VCSH_BASE" ] && VCSH_BASE="$XDG_CONFIG_HOME/vcsh/repo.d" [ -z "$VCSH_BASE" ] && VCSH_BASE="$XDG_CONFIG_HOME/vcsh/repo.d"
SELF=$(basename $0) SELF=$(basename $0)
if [ "$SELF" = 'bash' ] ||
[ "$SELF" = 'dash' ] ||
[ "$SELF" = 'sh' ] ||
[ "$SELF" = 'zsh' ]; then
SELF='vcsh'
VCSH_SOURCED=1
fi
help() { help() {
echo "usage: $SELF <args> echo "usage: $SELF <args>
...@@ -22,7 +14,6 @@ help() { ...@@ -22,7 +14,6 @@ help() {
help Display this help text help Display this help text
delete Delete an existing repository delete Delete an existing repository
enter Enter repository; spawn new $SHELL enter Enter repository; spawn new $SHELL
exit Exit repository; unset ENV
init <repo> Initialize a new repository init <repo> Initialize a new repository
list List all repositories list List all repositories
run <repo> \\ run <repo> \\
...@@ -31,7 +22,6 @@ help() { ...@@ -31,7 +22,6 @@ help() {
seed-gitignore \\ seed-gitignore \\
<repo> Seed .gitignore.d/<repo> from git ls-files <repo> Seed .gitignore.d/<repo> from git ls-files
setup Set up repository with recommended settings setup Set up repository with recommended settings
use <repo> Use repository; set ENV
<repo> <git command> Special command that allows you to run git commands <repo> <git command> Special command that allows you to run git commands
directly without having to type so much ;)" >&2 directly without having to type so much ;)" >&2
...@@ -69,12 +59,6 @@ init() { ...@@ -69,12 +59,6 @@ init() {
verbose "init() end" verbose "init() end"
} }
leave() {
unset GIT_DIR
unset GIT_WORK_TREE
unset VCSH_DIRECTORY
}
use() { use() {
verbose "use() begin" verbose "use() begin"
if [ ! -d "$GIT_DIR" ]; then if [ ! -d "$GIT_DIR" ]; then
...@@ -101,8 +85,7 @@ elif [ "$1" = 'delete' ] || ...@@ -101,8 +85,7 @@ elif [ "$1" = 'delete' ] ||
[ "$1" = 'init' ] || [ "$1" = 'init' ] ||
[ "$1" = 'run' ] || [ "$1" = 'run' ] ||
[ "$1" = 'seed-gitignore' ] || [ "$1" = 'seed-gitignore' ] ||
[ "$1" = 'setup' ] || [ "$1" = 'setup' ]; then
[ "$1" = 'use' ]; then
[ -z $2 ] && echo "$SELF $1: error: please specify repository to work on" && return 1 [ -z $2 ] && echo "$SELF $1: error: please specify repository to work on" && return 1
export VCSH_COMMAND="$1" export VCSH_COMMAND="$1"
export VCSH_REPO_NAME="$2" export VCSH_REPO_NAME="$2"
...@@ -112,8 +95,7 @@ elif [ "$1" = 'delete' ] || ...@@ -112,8 +95,7 @@ elif [ "$1" = 'delete' ] ||
if [ "$VCSH_COMMAND" = 'run' ]; then if [ "$VCSH_COMMAND" = 'run' ]; then
[ -z "$VCSH_EXTERNAL_COMMAND" ] && echo "$SELF $1 $2: error: please specify a command" && return 1 [ -z "$VCSH_EXTERNAL_COMMAND" ] && echo "$SELF $1 $2: error: please specify a command" && return 1
fi fi
elif [ "$1" = 'exit' ] || elif [ "$1" = 'help' ] ||
[ "$1" = 'help' ] ||
[ "$1" = 'list' ]; then [ "$1" = 'list' ]; then
export VCSH_COMMAND="$1" export VCSH_COMMAND="$1"
else else
...@@ -158,7 +140,6 @@ if [ "$VCSH_COMMAND" = 'clone' ]; then ...@@ -158,7 +140,6 @@ if [ "$VCSH_COMMAND" = 'clone' ]; then
echo " Once this situation has been resolved, run 'vcsh run <foo> git pull' to finish cloning.\n" && echo " Once this situation has been resolved, run 'vcsh run <foo> git pull' to finish cloning.\n" &&
return 3 return 3
git merge origin/master git merge origin/master
# use || return $?
verbose "clone end" verbose "clone end"
#elif [ "$VCSH_COMMAND" = 'help' ] || [ "$#" -eq 0 ]; then #elif [ "$VCSH_COMMAND" = 'help' ] || [ "$#" -eq 0 ]; then
...@@ -191,25 +172,11 @@ elif [ "$VCSH_COMMAND" = 'enter' ]; then ...@@ -191,25 +172,11 @@ elif [ "$VCSH_COMMAND" = 'enter' ]; then
verbose "enter begin" verbose "enter begin"
use || return $? use || return $?
$SHELL $SHELL
leave
verbose "enter end" verbose "enter end"
elif [ "$VCSH_COMMAND" = 'exit' ]; then
verbose "exit begin"
# if [ -n "$ZSH_VERSION" ] && [ "$VCSH_NO_IGNORE_EOF" = '1' ]; then
# unset VCSH_NO_IGNORE_EOF
# setopt NO_IGNORE_EOF
# fi
[ -z "$VCSH_SOURCED" ] && echo "$SELF $VCSH_COMMAND: You need to source vcsh if you want to run in this mode" && return 10
leave
# [ -n "$ZSH_VERSION" ] && [ "$USER" = richih ] && buildPS1
verbose "exit end"
return 0
elif [ "$VCSH_COMMAND" = 'init' ]; then elif [ "$VCSH_COMMAND" = 'init' ]; then
verbose "init begin" verbose "init begin"
init init
# use || return $?
verbose "init end" verbose "init end"
elif [ "$VCSH_COMMAND" = 'list' ]; then elif [ "$VCSH_COMMAND" = 'list' ]; then
...@@ -223,7 +190,6 @@ elif [ "$VCSH_COMMAND" = 'run' ]; then ...@@ -223,7 +190,6 @@ elif [ "$VCSH_COMMAND" = 'run' ]; then
verbose "run begin" verbose "run begin"
use || return $? use || return $?
$VCSH_EXTERNAL_COMMAND $VCSH_EXTERNAL_COMMAND
leave
verbose "run end" verbose "run end"
elif [ "$VCSH_COMMAND" = 'seed-gitignore' ]; then elif [ "$VCSH_COMMAND" = 'seed-gitignore' ]; then
...@@ -265,28 +231,8 @@ elif [ "$VCSH_COMMAND" = 'setup' ]; then ...@@ -265,28 +231,8 @@ elif [ "$VCSH_COMMAND" = 'setup' ]; then
verbose "seed-gitignore begin" verbose "seed-gitignore begin"
use || return $? use || return $?
setup || return $? setup || return $?
leave
verbose "seed-gitignore end" verbose "seed-gitignore end"
elif [ "$VCSH_COMMAND" = 'use' ]; then
verbose "use begin"
# if [ -n "$ZSH_VERSION" ]; then
# if [ -o NO_IGNORE_EOF ]; then
# export VCSH_NO_IGNORE_EOF=1
# setopt IGNORE_EOF
# fi
# vcsh_exit() {
# vcsh exit;
# zle reset-prompt;
# }
# zle -N vcsh_exit
# bindkey '^d' 'vcsh_exit'
# fi
[ -z "$VCSH_SOURCED" ] && echo "$SELF $VCSH_COMMAND: You need to source vcsh if you want to run in this mode" && return 10
use || return $?
# [ -n "$ZSH_VERSION" ] && [ "$USER" = richih ] && buildPS1
verbose "use end"
else else
verbose "defaulting to calling help()" verbose "defaulting to calling help()"
help help
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment