Compare commits
1 Commits
f307928529
...
zcurses/bu
| Author | SHA1 | Date | |
|---|---|---|---|
| 3194afc80d |
@@ -16,6 +16,8 @@
|
||||
- {src: zshrc, dst: ~/.zshrc}
|
||||
- src: prompt_fresh_setup
|
||||
dst: ~/.local/share/zsh/site-functions/prompt_fresh_setup
|
||||
- src: build/_build-dir
|
||||
dst: ~/.local/share/zsh/site-functions/_build-dir
|
||||
- src: sandbox/_sandbox
|
||||
dst: ~/.local/share/zsh/site-functions/_sandbox
|
||||
- src: layout/_layout
|
||||
@@ -26,6 +28,4 @@
|
||||
- https://github.com/zsh-users/zsh-autosuggestions.git
|
||||
- https://github.com/zsh-users/zsh-history-substring-search.git
|
||||
- https://github.com/zdharma/fast-syntax-highlighting.git
|
||||
- pip:
|
||||
- pick
|
||||
- message: zsh will be the default prompt after next login
|
||||
|
||||
6
build/_build-dir
Normal file
6
build/_build-dir
Normal file
@@ -0,0 +1,6 @@
|
||||
#compdef build-dir
|
||||
|
||||
_arguments \
|
||||
'(-h --help)'{-h,--help}'[]' \
|
||||
'--build[invoke a build after selection]' \
|
||||
'1:directory:_files'
|
||||
@@ -21,7 +21,6 @@ fi
|
||||
build-dir() {
|
||||
local usage='usage: build-dir [-h] [--build] [<directory>]'
|
||||
local -a help do_build
|
||||
zmodload zsh/zutils
|
||||
zparseopts -D h=help -help=help -build=do_build
|
||||
if [[ -n $help ]]; then
|
||||
cat << EOF
|
||||
@@ -36,9 +35,9 @@ optional arguments:
|
||||
-h, --help show this help message and exit
|
||||
--build invoke a build after selection
|
||||
EOF
|
||||
exit
|
||||
return
|
||||
fi
|
||||
error() { echo "\e[31merror:\e[0m $1"; exit 1 }
|
||||
error() { echo "\e[31merror:\e[0m $1"; return 1 }
|
||||
local build_dir
|
||||
if [[ ${#*} -gt 1 ]]; then
|
||||
echo $usage
|
||||
@@ -55,7 +54,7 @@ EOF
|
||||
local -a build_dirs
|
||||
for entry in `ls -A`; do
|
||||
[ -d $entry ] && [[ $entry =~ build* ]] && \
|
||||
build_dirs+=$entry
|
||||
build_dirs+=${entry/\//}
|
||||
done
|
||||
|
||||
# Interactively select a build directory if more than 1 found
|
||||
@@ -75,7 +74,7 @@ EOF
|
||||
|
||||
# Hide the cursor for zcurses, trap SIGINT to ensure cleanup in
|
||||
# always-list occurs below
|
||||
tput civis; trap 'exit 130' INT
|
||||
tput civis; trap 'return 130' INT
|
||||
|
||||
# Enter display loop
|
||||
local key keypad
|
||||
@@ -139,7 +138,7 @@ EOF
|
||||
fi
|
||||
|
||||
# If the build variable is not defined the command could not be determined
|
||||
if [ -n $build ]; then
|
||||
if [ -z $build ]; then
|
||||
echo "\e[33mwarning:\e[0m build command detection failed: $build_dir"
|
||||
# Prompt user to enter a build command
|
||||
vared -p 'enter comand: ' build
|
||||
|
||||
Reference in New Issue
Block a user