summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/macports/_port89
-rw-r--r--plugins/macports/macports.plugin.zsh5
-rw-r--r--themes/tjkirch.zsh-theme15
3 files changed, 109 insertions, 0 deletions
diff --git a/plugins/macports/_port b/plugins/macports/_port
new file mode 100644
index 000000000..06d7fb426
--- /dev/null
+++ b/plugins/macports/_port
@@ -0,0 +1,89 @@
+#compdef port
+
+local subcmds
+
+# we cache the list of ports
+# we shall use some cache policy to avoid problems with new ports
+if (( ! $+portlist )); then
+ portlist=($(port echo all; echo "all current active inactive installed uninstalled outdated"))
+fi
+
+subcmds=(
+'activate'
+'archive'
+'build'
+'cat'
+'clean'
+'configure'
+'contents'
+'deactivate'
+'dependents'
+'deps'
+'destroot'
+'dir'
+'distcheck'
+'distclean'
+'dmg'
+'echo'
+'edit'
+'extract'
+'fetch'
+'file'
+'help'
+'info'
+'install'
+'installed'
+'list'
+'livecheck'
+'location'
+'mpkg'
+'outdated'
+'patch'
+'pkg'
+'provides'
+'rpmpackage'
+'search'
+'selfupdate'
+'sync'
+'test'
+'unarchive'
+'uninstall'
+'upgrade'
+'variants'
+'version'
+)
+
+_arguments -C \
+'-v[verbose mode (generate verbose messages)]' \
+'-d[debug mode (generate debugging messages)]' \
+'-q[quiet mode (suppress messages)]' \
+'-D[specify portdir]' \
+'-k[keep mode (do not autoclean after install)]' \
+'-n[dont follow dependencies in upgrade (only for upgrading)]' \
+'-a[upgrade all installed ports (only for upgrading)]' \
+'-u[uninstall non-active ports when upgrading and uninstalling]' \
+'-f[force mode (ignore state file)]' \
+'-s[source-only mode]' \
+'-b[binary-only mode]' \
+'-o[honor state files older than Portfile]' \
+'*::command:->command' \
+&& return 0
+
+case $state in
+ command)
+ if ((CURRENT == 1)); then
+ state=subcommands
+ else
+ state=portname
+ fi
+ ;;
+esac
+
+case $state in
+ subcommands)
+ _describe -t commands 'port commands' subcmds
+ ;;
+ portname)
+ _describe -t commands 'available ports' portlist
+ ;;
+esac
diff --git a/plugins/macports/macports.plugin.zsh b/plugins/macports/macports.plugin.zsh
index 9564829b0..cbbc49265 100644
--- a/plugins/macports/macports.plugin.zsh
+++ b/plugins/macports/macports.plugin.zsh
@@ -5,3 +5,8 @@ alias psu="sudo port selfupdate"
alias puni="sudo port uninstall inactive"
alias puo="sudo port upgrade outdated"
alias pup="psu && puo"
+
+# add macports completion function to path
+fpath=($ZSH/plugins/macports $fpath)
+autoload -U compinit
+compinit -i
diff --git a/themes/tjkirch.zsh-theme b/themes/tjkirch.zsh-theme
new file mode 100644
index 000000000..446cde724
--- /dev/null
+++ b/themes/tjkirch.zsh-theme
@@ -0,0 +1,15 @@
+ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[green]%}"
+ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
+ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[red]%}⚡"
+ZSH_THEME_GIT_PROMPT_CLEAN=""
+
+function prompt_char {
+ if [ $UID -eq 0 ]; then echo "%{$fg[red]%}#%{$reset_color%}"; else echo $; fi
+}
+
+PROMPT='%(?, ,%{$fg[red]%}FAIL: $?%{$reset_color%}
+)
+%{$fg[magenta]%}%n%{$reset_color%}@%{$fg[yellow]%}%m%{$reset_color%}: %{$fg_bold[blue]%}%~%{$reset_color%}$(git_prompt_info)
+%_$(prompt_char) '
+
+RPROMPT='%{$fg[green]%}[%*]%{$reset_color%}'