summaryrefslogtreecommitdiff
path: root/zsh/_prt-get
blob: 7691af757f0458978ab919d11b21fe0739ee733f (plain)
    1 #compdef prt-get prt-cache
    2 
    3 local curcontext="$curcontext" expl ret=1 subcmd
    4 
    5 _list_notinstalled() {
    6   local liste expl pkgs
    7   local -a disp
    8 
    9   installed=($(prt-cache listinst))
   10   pkgs=($(prt-cache list))
   11   pkgs=(${pkgs:#${(j:|:)~${installed:q}}})
   12 
   13   _wanted packages expl 'packages' \
   14   compadd "$@" "$disp[@]" - "${(@)pkgs%%:*}"
   15 
   16 }
   17 
   18 _list() {
   19   local liste expl pkgs installed
   20   local -a disp
   21 
   22   pkgs=($(prt-cache list))
   23 
   24   _wanted packages expl 'packages' \
   25   compadd "$@" "$disp[@]" - "${(@)pkgs%%:*}"
   26 
   27 }
   28 
   29 _listinstalled() {
   30   local liste expl pkgs installed
   31   local -a disp
   32 
   33   pkgs=($(prt-cache listinst))
   34 
   35   _wanted packages expl 'packages' \
   36   compadd "$@" "$disp[@]" - "${(@)pkgs%%:*}"
   37 
   38 }
   39 
   40 _listlocked() {
   41   local liste expl pkgs installed
   42   local -a disp
   43 
   44   pkgs=($(prt-cache listlocked))
   45 
   46   _wanted packages expl 'packages' \
   47   compadd "$@" "$disp[@]" - "${(@)pkgs%%:*}"
   48 
   49 }
   50 
   51 _listupdates() {
   52   local liste expl pkgs installed
   53   local -a disp
   54 
   55   pkgs=($(prt-cache quickdiff))
   56 
   57   _wanted packages expl 'packages' \
   58   compadd "$@" "$disp[@]" - "${(@)pkgs%%:*}"
   59 
   60 }
   61 
   62 
   63 if (( CURRENT == 2 )); then
   64   _describe 'prt-get command' '(
   65     install:install\ package
   66     depinst:install\ package\ including\ its\ dependencies
   67     grpinst:install\ given\ packages\ but\ stop\ if\ installation\ of\ a\ package\ fails
   68     update:update\ package
   69     remove:remove\ package
   70     sysup:update\ all\ installed\ packages\ which\ are\ outdated
   71     lock:do\ not\ take\ into\ account\ these\ packages\ in\ sysup\ operation
   72     unlock:remove\ lock\ from\ package
   73     listlocked:list\ all\ locked\ packages
   74     diff:show\ differences\ between\ installed\ packages\ and\ ports\ in\ the\ ports\ tree
   75     quickdiff:print\ a\ simple\ list\ of\ packages\ whose\ versions\ differ\ from\ those\ in\ the\ ports\ tree
   76     search:search\ ports\ tree\ for\ packages\ matching
   77     dsearch:search\ ports\ tree\ for\ package\ name\ or\ description
   78     fsearch:search\ for\ files\ in\ packages\ footprint
   79     info:display\ information\ about\ a\ port
   80     path:print\ path\ of\ a\ port
   81     readme:print\ a\ ports\ readme
   82     depends:print\ a\ recursive\ list\ of\ ports\ that\ are\ required\ by\ the\ given\ ports
   83     quickdep:print\ a\ simple\ list\ of\ recursive\ dependencies\ of\ the\ given\ ports
   84     dependent:print\ a\ list\ of\ ports\ depending\ on\ the\ given\ port
   85     deptree:print\ a\ tree\ of\ dependencies\ of\ the\ given\ package
   86     dup:list\ ports\ that\ can\ be\ found\ in\ multiple\ port\ directories
   87     list:list\ ports\ available\ in\ the\ ports\ tree
   88     printf:print\ formated\ port\ list
   89     listinst:list\ installed\ ports
   90     listorphans:list\ installed\ ports\ which\ have\ no\ no\ dependent\ packages
   91     isinst:check\ wether\ a\ given\ package\ is\ installed
   92     current:print\ version\ of\ an\ installed\ package
   93     ls:print\ the\ the\ files\ of\ a\ package\ directory
   94     cat:print\ the\ content\ of\ a\ file\ in\ a\ ports\ directory
   95     edit:edit\ a\ packages\ file
   96     help:show\ available\ options
   97     dumpconfig:dump\ the\ current\ configuration
   98     cache:create\ the\ cache\ file\ for\ prt-cache
   99     version:show\ the\ current\ version\ of\ prt-get
  100   )' && ret=0
  101 
  102 else
  103   shift words
  104   (( CURRENT-- ))
  105   subcmd="$words[1]"
  106   curcontext="${curcontext%:*}-${subcmd}:"
  107   
  108   if (( CURRENT == 2 )); then
  109     case $subcmd in
  110       remove|lock|current) _listinstalled && ret=0 ;;
  111       path|depends|dependent|deptree|isinst|ls|cat|edit) _list && ret=0 ;;
  112       unlock) _listlocked && ret=0 ;;
  113       install|grpinst|depinst) _list_notinstalled  && ret=0 ;;
  114       info|readme|search) _list && ret=0 ;;
  115       update) _listupdates && ret=0 ;;
  116       *) _message 'unknown subcommand: $subcmd' ;;
  117     esac
  118   fi
  119 fi
  120 
  121 
  122 
  123 return ret

Generated by cgit