Compare commits

..

1 Commits

Author SHA1 Message Date
44bab917c9 Replace build-dir.py with zcurses build-dir
Update the build-dir shell function to usage zcurses instead of the
Python pick package to interactively select build directories, this
results in a more responsive user experience. Add argument parsing to
handle various use cases. Add prompt when the build command for the
selected build directory could not be detected, allowing the user to
specify the desired build command.

```
usage: build-dir [-h] [--build] [<directory>]

Find and select the current build directory interactively.

positional arguments:
  <directory> the build directory to select

optional arguments:
  -h, --help  show this help message and exit
  --build     invoke a build after selection
```
2018-08-24 10:31:31 +01:00
3 changed files with 9 additions and 4 deletions

View File

@ -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
View File

@ -0,0 +1,6 @@
#compdef build-dir
_arguments \
'(-h --help)'{-h,--help}'[]' \
'--build[invoke a build after selection]' \
'1:directory:_files'

View File

@ -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
@ -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