Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support zsh completions, fix #173 #177

Merged
merged 1 commit into from
Mar 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Support zsh completion, fix #173
  • Loading branch information
Freed-Wu committed Mar 14, 2023
commit bc2a580a4f413d396920b1f06d3b93d15d07d53b
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ endif
PREFIX ?= /usr/local
BINDIR = $(PREFIX)/bin
MANDIR = $(PREFIX)/share/man/man1
ZSHDIR = $(PREFIX)/share/zsh/site-functions

$(OBJ) : progress.o sizes.o hlist.o
$(CC) -Wall $^ -o $@ $(LDFLAGS)
Expand All @@ -38,6 +39,10 @@ install : $(OBJ)
@mkdir -p $(DESTDIR)$(MANDIR)
@install -pm0644 $(OBJ).1 $(DESTDIR)$(MANDIR)/ || \
echo "Failed. Try "make PREFIX=~ install" ?"
@echo "Installing zsh completion to $(DESTDIR)$(ZSHDIR) ..."
@install -Dpm0644 _$(OBJ) -t $(DESTDIR)$(ZSHDIR)/ || \
echo "Failed. Try "make PREFIX=~ install" ?"
uninstall :
@rm -f $(DESTDIR)$(BINDIR)/$(OBJ)
@rm -f $(DESTDIR)$(MANDIR)/$(OBJ).1
@rm -f $(DESTDIR)$(ZSHDIR)/_$(OBJ)
25 changes: 25 additions & 0 deletions _progress
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#compdef progress
# ------------------------------------------------------------------------------
# Description
# -----------
#
# zsh completion script for progress
#
# ------------------------------------------------------------------------------

local options=(
{-q,--quiet}'[hides all messages]'
{-d,--debug}'[shows all warning/error messages]'
{-w,--wait}'[estimate I/O throughput and ETA (slower display)]'
'(-w)'{-W,--wait-delay}'[wait 'secs' seconds for I/O estimation (implies -w, default=1.0)]:secs'
{-m,--monitor}'[loop while monitored processes are still running]'
{-M,--monitor-continuously}'[like monitor but never stop (similar to watch progress)]'
{-a,--additional-command}'[add additional command to default command list]: :{_command_names -e}'
{-c,--command}'[monitor only this command name (ex: firefox)]: :{_command_names -e}'
{-p,--pid}'[monitor only this process ID (ex: $(pidof firefox))]: :_ps'
{-i,--ignore-file}'[do not report process if using file]: :_files'
{-o,--open-mode}'[report only files opened for read or write]:rw:(r w)'
'(- : *)'{-v,--version}'[show program version and exit]'
'(- : *)'{-h,--help}'[display this help and exit]'
)
_arguments -s -S $options