Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Moving completion functions



Below is the first version of the script I'll use.  I'm planning to
wait until Monday so that everyone who wants can have a look if the
classification is fine.  On Monday I'll look through the suggestions I
got till then and  change the script accordingly.  Before starting,
I'll send a mail telling you when I'll begin so that you don't check
out messed up intermediate versions.  (Of course I'll also send a
notice when the script/function has finished -- after or before that
I'll have to change the files mentioned at the end of the script.)

Unless the script or my comments below make us think that we should
organise the functions in some other way, that is.  In that I won't
start on Monday.

There are 281 functions...

I've used Oliver's suggestion for exchanging the names of the Core and 
Base directories and Bart's suggestion to use the singular.  I'm still 
not too happy with the name `Type', but since we constantly say things 
like `type of matches' in the docs, this name is probably not that
bad.

Some directories (esp. Unix/Command) could make one think about
splitting them up even further (Unix/Net, Unix/Graphic, but also
Zsh/Function and probably others).  And, again (or still), some
functions could sensibly be put into different directories.  For
example, I've put things like _tex, _ps etc. into Unix/Type because
they complete certain types of files.  The rule of thumb is that those
functions were put into Type that are usable as functions for
completing types of <whatever>, even if they aren't (yet) used in that
way.  The difference between Type and Utility, btw., is that Utility
holds functions that don't generate matches themselves, they are only
used to generate matches, telling them how to do that (i.e.:
_arguments and the like).

For some files we could also think about better names, maybe (_vars_eq 
comes to mind).

Any better way to update the .distfiles[1]?

Ok, that's it for now... Opinions? Suggestions?


Bye
 Sven

[1] I've seen that Peter had to update some .distfiles again lately.
    That was almost certainly my fault again.  Sorry and thanks, Peter.


move1() {
  local name dir1 dir2

  name=${1:t}
  [[ $2 = */*/* && $2 != */*/*/* ]] && 2=${2}/${name}

  if [[ ! -f $1 ]]; then
    if [[ -f $2 ]]; then
      echo $1 already moved to $2
      return
    else
      echo ERROR: $1 does not exist
      return
    fi
  fi

  echo moving $1 to $2

  dir2=${2:h}
  dir1=${dir2:h}

  if [[ ! -d $dir1 ]]; then
    echo new directory $dir1
    mkdir $dir1
    echo "  cvs add    $dir1"
    cvs add $dir1
    echo "  cvs commit $dir1"
    cvs commit -m 'new completion directory' $dir1
  fi

  if [[ ! -d $dir2 ]]; then
    echo new directory $dir2
    mkdir $dir2
    echo "  cvs add    $dir2"
    cvs add $dir2
    echo "  cvs commit $dir2"
    cvs commit -m 'new completion directory' $dir2
  fi

  cp $1 $2
  chmod 600 $2
  rm $1

  echo "  cvs remove $1"
  cvs remove $1
  echo "  cvs commit $1"
  cvs commit -m "moved to $2" $1

  echo "  cvs add    $2"
  cvs add $2
  echo "  cvs commit $2"
  cvs commit -m "moved from $1" $2
}


# Overall structure:
#
# Completion
#   comp{init,install,...}
#   Base
#     Core        basic functions
#     Completer   completers
#     Utility     utility functions (_arguments,...)
#     Widget      bindable commands
#   Zsh
#     Type        types of matches
#     Context     special contexts
#     Builtin     builtins
#   Unix
#     Type
#     Command
#   X/AIX/BSD/Debian/Redhat
#     Utility
#     Type
#     Command


files=(

Core/_all_labels                Base/Core
Core/_all_matches               Base/Completer
Core/_alternative               Base/Utility
Core/_approximate               Base/Completer
Core/_call                      Base/Core
Core/_compalso                  Base/Core
Core/_complete                  Base/Completer
Core/_correct                   Base/Completer
Core/_description               Base/Core
Core/_expand                    Base/Completer
Core/_expand_alias              Base/Completer
Core/_file_descriptors          Zsh/Type
Core/_files                     Unix/Type
Core/_funcall                   Base/Core
Core/_history                   Base/Completer
Core/_ignored                   Base/Completer
Core/_list                      Base/Completer
Core/_main_complete             Base/Core
Core/_match                     Base/Completer
Core/_menu                      Base/Completer
Core/_message                   Base/Core
Core/_multi_parts               Base/Utility
Core/_next_label                Base/Core
Core/_normal                    Base/Core
Core/_oldlist                   Base/Completer
Core/_options                   Zsh/Type
Core/_parameters                Zsh/Type
Core/_path_files                Unix/Type
Core/_prefix                    Base/Completer
Core/_requested                 Base/Core
Core/_sep_parts                 Base/Utility
Core/_set_options               Zsh/Type
Core/_setup                     Base/Core
Core/_tags                      Base/Core
Core/_unset_options             Zsh/Type
Core/_wanted                    Base/Core
Core/compaudit                  compaudit
Core/compdump                   compdump
Core/compinit                   compinit
Core/compinstall                compinstall

Base/_arg_compile               Base/Utility
Base/_arguments                 Base/Utility
Base/_brace_parameter           Zsh/Context
Base/_cache_invalid             Base/Utility
Base/_combination               Base/Utility
Base/_command_names             Zsh/Type
Base/_condition                 Zsh/Context
Base/_default                   Zsh/Context
Base/_describe                  Base/Utility
Base/_equal                     Zsh/Context
Base/_first                     Zsh/Context
Base/_in_vared                  Zsh/Context
Base/_jobs                      Zsh/Type
Base/_math                      Zsh/Context
Base/_parameter                 Zsh/Context
Base/_precommand                Zsh/Builtin
Base/_redirect                  Zsh/Context
Base/_regex_arguments           Base/Utility
Base/_retrieve_cache            Base/Utility
Base/_store_cache               Base/Utility
Base/_sub_commands              Base/Utility
Base/_subscript                 Zsh/Context
Base/_tilde                     Zsh/Context
Base/_value                     Zsh/Context
Base/_values                    Base/Utility

Commands/_bash_completions      Base/Widget
Commands/_complete_debug        Base/Widget
Commands/_complete_help         Base/Widget
Commands/_complete_tag          Base/Widget
Commands/_correct_filename      Base/Widget
Commands/_correct_word          Base/Widget
Commands/_expand_word           Base/Widget
Commands/_generic               Base/Widget
Commands/_history_complete_word Base/Widget
Commands/_most_recent_file      Base/Widget
Commands/_next_tags             Base/Widget
Commands/_read_comp             Base/Widget

Builtins/_aliases               Zsh/Type
Builtins/_arrays                Zsh/Type
Builtins/_autoload              Zsh/Builtin
Builtins/_bg_jobs               Zsh/Type
Builtins/_bindkey               Zsh/Builtin
Builtins/_builtin               Zsh/Builtin
Builtins/_cd                    Zsh/Builtin
Builtins/_command               Zsh/Builtin
Builtins/_compdef               Zsh/Builtin      # some of these are functions
Builtins/_disable               Zsh/Builtin
Builtins/_echotc                Zsh/Builtin
Builtins/_emulate               Zsh/Builtin
Builtins/_enable                Zsh/Builtin
Builtins/_fc                    Zsh/Builtin
Builtins/_fg_jobs               Zsh/Type
Builtins/_functions             Zsh/Type
Builtins/_hash                  Zsh/Builtin
Builtins/_kill                  Zsh/Builtin
Builtins/_limits                Zsh/Type
Builtins/_nothing               Base/Utility
Builtins/_pids                  Unix/Type
Builtins/_popd                  Zsh/Builtin
Builtins/_print                 Zsh/Builtin
Builtins/_read                  Zsh/Builtin
Builtins/_sched                 Zsh/Builtin
Builtins/_set                   Zsh/Builtin
Builtins/_setopt                Zsh/Builtin
Builtins/_signals               Unix/Type
Builtins/_source                Zsh/Builtin
Builtins/_stat                  Zsh/Builtin
Builtins/_trap                  Zsh/Builtin
Builtins/_unhash                Zsh/Builtin
Builtins/_unsetopt              Zsh/Builtin
Builtins/_vars                  Zsh/Type
Builtins/_vars_eq               Zsh/Builtin
Builtins/_wait                  Zsh/Builtin
Builtins/_which                 Zsh/Builtin
Builtins/_zcompile              Zsh/Builtin
Builtins/_zftp                  Zsh/Builtin
Builtins/_zle                   Zsh/Builtin
Builtins/_zmodload              Zsh/Builtin
Builtins/_zpty                  Zsh/Builtin
Builtins/_zstyle                Zsh/Builtin

User/_a2ps                      Unix/Command
User/_apachectl                 Unix/Command
User/_archie                    Unix/Command
User/_arp                       Unix/Command
User/_bison                     Unix/Command
User/_bzip2                     Unix/Command
User/_chown                     Unix/Command
User/_compress                  Unix/Command
User/_configure                 Unix/Command
User/_cvs                       Unix/Command
User/_dd                        Unix/Command
User/_dict                      Unix/Command
User/_diff                      Unix/Command
User/_diff_options              Unix/Type
User/_dir_list                  Unix/Type
User/_dirs                      Unix/Type
User/_domains                   Unix/Type
User/_dvi                       Unix/Command
User/_enscript                  Unix/Command
User/_fakeroot                  Unix/Command
User/_fetchmail                 Unix/Command
User/_find                      Unix/Command
User/_finger                    Unix/Command
User/_flex                      Unix/Command
User/_gcc                       Unix/Command
User/_gdb                       Unix/Command
User/_getconf                   Unix/Command
User/_gprof                     Unix/Command
User/_grep                      Unix/Command
User/_groups                    Unix/Type
User/_gs                        Unix/Command
User/_gv                        Unix/Command
User/_gzip                      Unix/Command
User/_hosts                     Unix/Type
User/_iconv                     Unix/Command
User/_imagemagick               Unix/Command
User/_init_d                    Unix/Command
User/_ispell                    Unix/Command
User/_java                      Unix/Command
User/_joe                       Unix/Command
User/_killall                   Unix/Command
User/_look                      Unix/Command
User/_lp                        Unix/Command
User/_ls                        Unix/Command
User/_lynx                      Unix/Command
User/_lzop                      Unix/Command
User/_mailboxes                 Unix/Type
User/_make                      Unix/Command
User/_man                       Unix/Command
User/_mere                      Unix/Command
User/_mh                        Unix/Command
User/_mount                     Unix/Command
User/_mutt                      Unix/Command
User/_my_accounts               Unix/Type
User/_mysql_utils               Unix/Command
User/_ncftp                     Unix/Command
User/_nedit                     Unix/Command
User/_netscape                  Unix/Command
User/_newsgroups                Unix/Type
User/_nslookup                  Unix/Command
User/_other_accounts            Unix/Type
User/_pack                      Unix/Command
User/_patch                     Unix/Command
User/_pbm                       Unix/Command
User/_pdf                       Unix/Command
User/_perl                      Unix/Command
User/_perl_basepods             Unix/Type
User/_perl_builtin_funcs        Unix/Type
User/_perl_modules              Unix/Type
User/_perldoc                   Unix/Command
User/_ports                     Unix/Type
User/_prcs                      Unix/Command
User/_printers                  Unix/Type
User/_prompt                    Zsh/Builtin      # hmm... Zsh/Function?
User/_ps                        Unix/Type
User/_pspdf                     Unix/Type
User/_psutils                   Unix/Command
User/_rcs                       Unix/Command
User/_rlogin                    Unix/Command
User/_sh                        Unix/Command
User/_slrn                      Unix/Command
User/_socket                    Unix/Command
User/_ssh                       Unix/Command
User/_strip                     Unix/Command
User/_stty                      Unix/Command
User/_su                        Unix/Command
User/_sudo                      Unix/Command
User/_tar                       Unix/Command
User/_tar_archive               Unix/Type
User/_telnet                    Unix/Command
User/_tex                       Unix/Type
User/_texi                      Unix/Type
User/_tiff                      Unix/Command
User/_tilde_files               Unix/Type
User/_tin                       Unix/Command
User/_urls                      Unix/Type
User/_use_lo                    Base/Utility
User/_user_at_host              Unix/Type
User/_users                     Unix/Type
User/_users_on                  Unix/Type
User/_w3m                       Unix/Command
User/_webbrowser                Unix/Command
User/_wget                      Unix/Command
User/_whereis                   Unix/Command
User/_whois                     Unix/Command
User/_xargs                     Unix/Command
User/_yodl                      Unix/Command
User/_yp                        Unix/Command
User/_zcat                      Unix/Command
User/_zdump                     Unix/Command
User/_zip                       Unix/Command

X/_x_arguments                  X/Utility
X/_x_borderwidth                X/Type
X/_x_color                      X/Type
X/_x_colormapid                 X/Type
X/_x_cursor                     X/Type
X/_x_display                    X/Type
X/_x_extension                  X/Type
X/_x_font                       X/Type
X/_x_geometry                   X/Type
X/_x_keysym                     X/Type
X/_x_locale                     X/Type
X/_x_modifier                   X/Type
X/_x_name                       X/Type
X/_x_resource                   X/Type
X/_x_selection_timeout          X/Type
X/_x_title                      X/Type
X/_x_window                     X/Type
X/_xauth                        X/Command
X/_xdvi                         X/Command
X/_xfig                         X/Command
X/_xmodmap                      X/Command
X/_xrdb                         X/Command
X/_xset                         X/Command
X/_xt_arguments                 X/Utility
X/_xt_session_id                X/Type
X/_xterm                        X/Command
X/_xutils                       X/Command
X/_xv                           X/Command
X/_xwit                         X/Command

AIX/_floppy                     AIX/Command
AIX/_logical_volumes            AIX/Type
AIX/_lscfg                      AIX/Command
AIX/_lsdev                      AIX/Command
AIX/_lslv                       AIX/Command
AIX/_lspv                       AIX/Command
AIX/_lsvg                       AIX/Command
AIX/_object_classes             AIX/Type
AIX/_physical_volumes           AIX/Type
AIX/_smit                       AIX/Command
AIX/_volume_groups              AIX/Type

Bsd/_bsd_pkg                    BSD/Command
Bsd/_cvsup                      BSD/Command
Bsd/_kld                        BSD/Command

Linux/_rpm                      Redhat/Command

Debian/_apt                     Debian/Command
Debian/_bug                     Debian/Command
Debian/_deb_packages            Debian/Type
Debian/_dpkg                    Debian/Command
Debian/_dpkg-source             Debian/Command/_dpkg_source
Debian/_dupload                 Debian/Command

)


move() {
  local i

  while (( $# )); do
    move1 Completion/$1 Completion/$2

    shift 2
  done

  for i in Completion/*/*(/)
    print "DISTFILES_SRC='" >  $i/.distfiles
    print .distfiles        >> $i/.distfiles
    print -c $i/*(.)        >> $i/.distfiles
    print "'"               >> $i/.distfiles
  done

  # Change:
  #   Completion/.distfiles
  #   Completion/compaudit
  #   Completion/compinstall
  #   Doc/Zsh/compsys.yo
  #   Doc/Zsh/contrib.yo
  #   Doc/Zsh/zftpsys.yo
  #   INSTALL
  #   Src/Zle/complete.mdd
  #   Test/ztst.zsh
  #   The Guide
}


move $files

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



Messages sorted by: Reverse Date, Date, Thread, Author