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

Moving completion functions



Here's the latest version of the script.

The things left to decide are (if I'm not mistaken) the names of some
of the functions.

I really only have a suggestion for _compalso: putting it into
Base/Utility and renaming it to `_contexts' because it completes
everything for the context described in the arguments, just like
_arguments and other functions in Utility.

And a better name for `_wanted' might be `_offer', but that doesn't
make it easier to find in a directory listing, of course.  Although it
would end up just before `_requested' and there are only twelve
functions in the directory anyway.

Twelve, unless we move the _call_* function into the Utility directory,
too, which seems sensible, somehow.


I've rearranged the functions, sorted by their new position.


Bye
 Sven


move2() {
  perl -ne \
    's/\b_set_options\b/_options_set/g;
     s/\b_unset_options\b/_options_unset/g;
     s/\b_popd\b/_directory_stack/g;
     s/\b_call\b/_call_program/g;
     s/\b_funcall\b/_call_function/g;
     print' $1 > $2
}


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

  move2 $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
#     Command     builtins and functions
#   Unix
#     Type
#     Command
#   X/AIX/BSD/Debian/Redhat
#     Utility
#     Type
#     Command


files=(

## Completion

Core/compaudit                  compaudit
Core/compdump                   compdump
Core/compinit                   compinit
Core/compinstall                compinstall

Core/_all_labels                Base/Core
Core/_compalso                  Base/Core
Core/_description               Base/Core
Core/_main_complete             Base/Core
Core/_message                   Base/Core
Core/_next_label                Base/Core
Core/_normal                    Base/Core
Core/_requested                 Base/Core
Core/_setup                     Base/Core
Core/_tags                      Base/Core
Core/_wanted                    Base/Core
Core/_funcall                   Base/Core/_call_function
Core/_call                      Base/Core/_call_program
Core/_all_matches               Base/Completer
Core/_approximate               Base/Completer
Core/_complete                  Base/Completer
Core/_correct                   Base/Completer
Core/_expand                    Base/Completer
Core/_expand_alias              Base/Completer
Core/_history                   Base/Completer
Core/_ignored                   Base/Completer
Core/_list                      Base/Completer
Core/_match                     Base/Completer
Core/_menu                      Base/Completer
Core/_oldlist                   Base/Completer
Core/_prefix                    Base/Completer
Base/_arg_compile               Base/Utility
Base/_arguments                 Base/Utility
Base/_cache_invalid             Base/Utility
Base/_combination               Base/Utility
Base/_describe                  Base/Utility
Base/_regex_arguments           Base/Utility
Base/_retrieve_cache            Base/Utility
Base/_store_cache               Base/Utility
Base/_sub_commands              Base/Utility
Base/_values                    Base/Utility
Builtins/_nothing               Base/Utility
Core/_alternative               Base/Utility
Core/_multi_parts               Base/Utility
Core/_sep_parts                 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

Base/_command_names             Zsh/Type
Base/_jobs                      Zsh/Type
Builtins/_aliases               Zsh/Type
Builtins/_arrays                Zsh/Type
Builtins/_functions             Zsh/Type
Builtins/_limits                Zsh/Type
Builtins/_vars                  Zsh/Type
Core/_file_descriptors          Zsh/Type
Core/_options                   Zsh/Type
Core/_parameters                Zsh/Type
Builtins/_popd                  Zsh/Type/_directory_stack
Builtins/_bg_jobs               Zsh/Type/_jobs_bg
Builtins/_fg_jobs               Zsh/Type/_jobs_fg
Core/_set_options               Zsh/Type/_options_set
Core/_unset_options             Zsh/Type/_options_unset
Base/_brace_parameter           Zsh/Context
Base/_condition                 Zsh/Context
Base/_default                   Zsh/Context
Base/_equal                     Zsh/Context
Base/_first                     Zsh/Context
Base/_in_vared                  Zsh/Context
Base/_math                      Zsh/Context
Base/_parameter                 Zsh/Context
Base/_redirect                  Zsh/Context
Base/_subscript                 Zsh/Context
Base/_tilde                     Zsh/Context
Base/_value                     Zsh/Context
Base/_precommand                Zsh/Command
Builtins/_autoload              Zsh/Command
Builtins/_bindkey               Zsh/Command
Builtins/_builtin               Zsh/Command
Builtins/_cd                    Zsh/Command
Builtins/_command               Zsh/Command
Builtins/_compdef               Zsh/Command
Builtins/_disable               Zsh/Command
Builtins/_echotc                Zsh/Command
Builtins/_emulate               Zsh/Command
Builtins/_enable                Zsh/Command
Builtins/_fc                    Zsh/Command
Builtins/_hash                  Zsh/Command
Builtins/_kill                  Zsh/Command
Builtins/_print                 Zsh/Command
Builtins/_read                  Zsh/Command
Builtins/_sched                 Zsh/Command
Builtins/_set                   Zsh/Command
Builtins/_setopt                Zsh/Command
Builtins/_source                Zsh/Command
Builtins/_stat                  Zsh/Command
Builtins/_trap                  Zsh/Command
Builtins/_unhash                Zsh/Command
Builtins/_unsetopt              Zsh/Command
Builtins/_wait                  Zsh/Command
Builtins/_which                 Zsh/Command
Builtins/_zcompile              Zsh/Command
Builtins/_zftp                  Zsh/Command
Builtins/_zle                   Zsh/Command
Builtins/_zmodload              Zsh/Command
Builtins/_zpty                  Zsh/Command
Builtins/_zstyle                Zsh/Command
User/_mere                      Zsh/Command
User/_prompt                    Zsh/Command
Builtins/_vars_eq               Zsh/Command/_typeset

Builtins/_pids                  Unix/Type
Builtins/_signals               Unix/Type
Core/_files                     Unix/Type
Core/_path_files                Unix/Type
User/_diff_options              Unix/Type
User/_dir_list                  Unix/Type
User/_domains                   Unix/Type
User/_groups                    Unix/Type
User/_hosts                     Unix/Type
User/_mailboxes                 Unix/Type
User/_my_accounts               Unix/Type
User/_newsgroups                Unix/Type
User/_other_accounts            Unix/Type
User/_pdf                       Unix/Type
User/_perl_basepods             Unix/Type
User/_perl_builtin_funcs        Unix/Type
User/_perl_modules              Unix/Type
User/_ports                     Unix/Type
User/_printers                  Unix/Type
User/_ps                        Unix/Type
User/_pspdf                     Unix/Type
User/_tar_archive               Unix/Type
User/_tex                       Unix/Type
User/_texi                      Unix/Type
User/_tilde_files               Unix/Type
User/_urls                      Unix/Type
User/_user_at_host              Unix/Type
User/_users                     Unix/Type
User/_users_on                  Unix/Type
User/_dirs                      Unix/Type/_directories
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/_cpio                      Unix/Command
User/_cvs                       Unix/Command
User/_dd                        Unix/Command
User/_dict                      Unix/Command
User/_diff                      Unix/Command
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/_gs                        Unix/Command
User/_gzip                      Unix/Command
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/_make                      Unix/Command
User/_man                       Unix/Command
User/_mh                        Unix/Command
User/_mount                     Unix/Command
User/_mutt                      Unix/Command
User/_mysql_utils               Unix/Command
User/_ncftp                     Unix/Command
User/_nslookup                  Unix/Command
User/_pack                      Unix/Command
User/_patch                     Unix/Command
User/_pbm                       Unix/Command
User/_perl                      Unix/Command
User/_perldoc                   Unix/Command
User/_prcs                      Unix/Command
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/_telnet                    Unix/Command
User/_tiff                      Unix/Command
User/_tin                       Unix/Command
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
User/_use_lo                    Unix/Command/_gnu_generic

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/_xt_session_id                X/Type
X/_x_arguments                  X/Utility
X/_xt_arguments                 X/Utility
User/_gv                        X/Command
User/_nedit                     X/Command
User/_netscape                  X/Command
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/_xterm                        X/Command
X/_xv                           X/Command
X/_xwit                         X/Command
X/_xutils                       X/Command/_x_utils

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

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

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

Linux/_rpm                      Redhat/Command

## Other functions

Functions/Misc/acx		Functions/Example	# Misc?
Functions/Misc/allopt		Functions/Misc
Functions/Misc/cat		Functions/Example
Functions/Misc/cdmatch		Functions/Compctl
Functions/Misc/cdmatch2		Functions/Compctl
Functions/Misc/checkmail	Functions/Misc
Functions/Misc/colors		Functions/Misc
Functions/Misc/cx		Functions/Example	# Misc?
Functions/Misc/harden		Functions/Misc
Functions/Misc/is-at-least	Functions/Misc
Functions/Misc/mere		Functions/Misc
Functions/Misc/multicomp	Functions/Compctl
Functions/Misc/nslookup		Functions/Misc
Functions/Misc/promptnl		Functions/Misc
Functions/Misc/proto		Functions/Example
Functions/Misc/pushd		Functions/Example
Functions/Misc/randline		Functions/Example
Functions/Misc/run-help		Functions/Misc
Functions/Misc/yp		Functions/Example	# Misc?
Functions/Misc/yu		Functions/Example	# Misc?
Functions/Misc/zed		Functions/Misc
Functions/Misc/zkbd		Functions/Misc
Functions/Misc/zless		Functions/Example
Functions/Misc/zls		Functions/Example
Functions/Misc/zmv		Functions/Misc
Functions/Misc/zrecompile	Functions/Misc
Functions/Misc/zstyle+		Functions/Misc


## Test scripts

# Section A: basic command parsing and execution

Test/01grammar.ztst 	       	 Test/A01grammar.ztst
Test/02alias.ztst		 Test/A02alias.ztst
Test/03quoting.ztst		 Test/A03quoting.ztst
Test/04redirect.ztst		 Test/A04redirect.ztst
Test/05command.ztst		 Test/A05execution.ztst

# Section B: builtins

Test/50cd.ztst      	       	 Test/B01cd.ztst
# More, more, more

# Section C: shell commands with special syntax

Test/06arith.ztst		 Test/C01arith.ztst
Test/07cond.ztst		 Test/C02cond.ztst
Test/08traps.ztst		 Test/C03traps.ztst
Test/09funcdef.ztst		 Test/C04funcdef.ztst

# Section D: substititution

Test/10prompt.ztst		 Test/D01prompt.ztst
Test/11glob.ztst		 Test/D02glob.ztst
Test/12procsubst.ztst		 Test/D03procsubst.ztst
Test/13parameter.ztst		 Test/D04parameter.ztst
Test/14array.ztst		 Test/D05array.ztst

# Section E: options

# We need more tests here!  There was going to be an options test, but
# it's huge to write.

#                                [E01options.ztst]

Test/51xtrace.ztst		 Test/E02xtrace.ztst

# Section X: builtins

#				 [X01zmodload.ztst]

Test/52zregexparse.ztst		 Test/X02zregexparse.ztst

# Section Z: line editing and completion

Test/53completion.ztst      	 Test/Z01completion.ztst
Test/54compmatch.ztst		 Test/Z02compmatch.ztst
Test/55arguments.ztst            Test/Z03arguments.ztst

)


move() {
  local i

  while (( $# )); do
    [[ $1 = (Functions|Test)/* ]]; then
      move1 ./$1 ./$2
    else
      move1 Completion/$1 Completion/$2
    fi
    shift 2
  done

  for i in Completion/*/*(/) Functions/*(/) Test
    print "DISTFILES_SRC='" >  $i/.distfiles
    print .distfiles        >> $i/.distfiles
    print -c $i/*(.N)        >> $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
  #   Etc/completion-style-guide
  #   _dict_words
  #   is-at-least
  #   The Guide
}


echo updating
cvs update
echo adding tag
cvs tag pre-func-move .

move $files

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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