* Re: PATCH: new _prcs completion fonction
@ 2000-01-05 15:27 Sven Wischnowsky
0 siblings, 0 replies; 2+ messages in thread
From: Sven Wischnowsky @ 2000-01-05 15:27 UTC (permalink / raw)
To: zsh-workers
Alexandre Duret-Lutz wrote:
> The patch below add a completion fonction for the Project Revision Control
> System. I'm not sure you will like the chunk on computil.c :
> parse_cadef() was always skipping the first letter of any option name,
> I just made it look at it: this allow _argument to handle `--' as
> an option (this is used in the `execute' case of the _prcs function).
That's weird. Somehow I thought I had done that already when I last
changed the `-+/+-' test some lines above it. Maybe I did and then
found some other strange problems which I can't find now...
Bye
Sven
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
^ permalink raw reply [flat|nested] 2+ messages in thread
* PATCH: new _prcs completion fonction
@ 2000-01-05 13:45 Alexandre Duret-Lutz
0 siblings, 0 replies; 2+ messages in thread
From: Alexandre Duret-Lutz @ 2000-01-05 13:45 UTC (permalink / raw)
To: zsh-workers
[ I have sent the following patch on zsh-workers in two mails on
`01 Jan 2000 19:37:22 +0100' and `01 Jan 2000 21:27:58 +0100'.
I have received today an `addresses had permanent fatal errors'
message, so I am sending this again. I'm a bit surprised of this
since a third mail sent `02 Jan 2000 01:51:27 +0100' has hit the
list... ]
The patch below add a completion fonction for the Project Revision Control
System. I'm not sure you will like the chunk on computil.c :
parse_cadef() was always skipping the first letter of any option name,
I just made it look at it: this allow _argument to handle `--' as
an option (this is used in the `execute' case of the _prcs function).
Index: Src/Zle/computil.c
--- Src/Zle/computil.c Tue, 04 Jan 2000 16:13:01 +0100 Alexandre
+++ Src/Zle/computil.c Wed, 05 Jan 2000 14:01:18 +0100 Alexandre
@@ -640,9 +640,9 @@
zerrnam(nam, "invalid argument: %s", *args, 0);
return NULL;
}
- /* Skip over the name. */
- for (p += 2; *p && *p != ':' && *p != '[' &&
+ /* Skip over the name. */
+ for (p++; *p && *p != ':' && *p != '[' &&
((*p != '-' && *p != '+' && *p != '=') ||
(p[1] != ':' && p[1] != '[')); p++)
if (*p == '\\' && p[1])
Index: Completion/User/.distfiles
--- Completion/User/.distfiles Fri, 31 Dec 1999 13:32:44 +0100 Alexandre
+++ Completion/User/.distfiles Wed, 05 Jan 2000 14:01:13 +0100 Alexandre
@@ -5,7 +5,7 @@
_gunzip _gv _gzip _hosts _ispell _killall _lynx _mailboxes _make _man
_mh _mount _mutt _my_accounts _netscape _nslookup _other_accounts
_pack _patch _pbm _pdf _perl_basepods _perl_builtin_funcs
- _perl_modules _perldoc _ports _prompt _ps _pspdf _rcs _rlogin _sh
+ _perl_modules _perldoc _ports _prcs _prompt _ps _pspdf _rcs _rlogin _sh
_socket _ssh _strip _stty _su _sudo _tar _tar_archive _telnet _tex _tiff
_uncompress _unpack _urls _use_lo _user_at_host _users _users_on
_webbrowser _wget _whereis _whois _xargs _yodl _yp _zdump
Index: Completion/User/_prcs
--- Completion/User/_prcs Wed, 05 Jan 2000 14:29:04 +0100 Alexandre
+++ Completion/User/_prcs Wed, 05 Jan 2000 14:26:46 +0100 Alexandre
@@ -0,0 +1,203 @@
+#compdef prcs
+
+# lookup project names in the repository
+# (this does not handle subprojects)
+
+(( $+functions[_prcs_projects] )) ||
+_prcs_projects() {
+ compadd $@ - ${opt_args[-R]:-${opt_args[--repository]:-${PRCS_REPOSITORY:-$HOME/PRCS}}}/*(/:t)
+}
+
+# standard options for all subcommands
+
+(( $+functions[_prcs_arguments] )) ||
+_prcs_arguments() {
+ _arguments -s \
+ '(-f)--force[resolve interactive queries in some fixed way]' \
+ '(--force)-f[resolve interactive queries in some fixed way]' \
+ '(-h -H)--help[print out help]' \
+ '(--help -H)-h[print out help]' \
+ '(--help -h)-H[print out help]' \
+ '(-j)--jobs=[spawn many child processes at once]:number:' \
+ '(--jobs)-j[spawn many child processes at once]:number:' \
+ '(-l)--long-format[long format]' \
+ '(--long-format)-l[long format]' \
+ '(-L)--long-long-format[long format]' \
+ '(--long-long-format)-L[longer format]' \
+ '(-n)--no-action[no action]' \
+ '(--no-action)-n[no action]' \
+ '(-q)--quiet[suppress normal informational messages]' \
+ '(--quiet)-q[suppress normal informational messages]' \
+ "--plain-format[don't break lines at screen width]" \
+ '(-R)--repository=[set the repository directory]:directory:_files -/' \
+ '(--repository)-R[set the repository directory]:directory:_files -/' \
+ '(-v)--version[print PRCS version and exits]' \
+ '(--version)-v[print PRCS version and exits]' \
+ $@
+}
+
+if (( CURRENT == 2 )); then
+ _arguments \
+ ':prcs command:((
+ admin\:"admin subcommand"
+ checkin\:"checkin project revision"
+ checkout\:"checkout project revision"
+ config\:"verify configuration"
+ delete\:"delete named revision of project"
+ depopulate\:"remove named files from project descriptor"
+ diff\:"show differences between two revisions"
+ execute\:"execute a command for each file in a project"
+ info\:"print information about versions of project"
+ merge\:"reconcile differences between working files and another revision"
+ package\:"package the project and all its revisions into packagefile"
+ populate\:"add named files to project descriptor"
+ rekey\:"set keywords in selected files"
+ unpackage\:"unpackage project in packagefile"))'
+else
+ shift words
+ (( --CURRENT ))
+ case "$words[1]" in
+ admin)
+ if (( CURRENT == 2 )); then
+ _arguments \
+ ':admin subcommand:((
+ access\:"set the access permissions on the repository"
+ compress\:"instruct PRCS to save disk space for project"
+ init\:"create a repository entry"
+ pdelete\:"delete a repository entry"
+ prename\:"rename a repository entry"
+ rebuild\:"reconstruct PRCS data files in the repository"
+ uncompress\:"instruct PRCS to save time in processing project"))'
+ else
+ shift words
+ (( --CURRENT ))
+ case "$words[1]" in
+ access|compress|init|pdelete|prename|rebuild)
+ _prcs_arguments ':project name:_prcs_projects'
+ ;;
+ uncompress)
+ _prcs_arguments \
+ '-i[expand the entire project immediately]' \
+ ':project name:_prcs_projects'
+ ;;
+ esac
+ fi
+ ;;
+ checkin)
+ _prcs_arguments \
+ '(-r)--revison=[version of the project]:revision:' \
+ '(--revison)-r[version of the project]:revision:' \
+ '(-s)--skilled-merge[turn off most of the safety features of merge]' \
+ '(--skilled-merge)-s[turn off most of the safety features of merge]' \
+ ':project name:_prcs_projects' \
+ '*:file or directory:_files'
+ ;;
+ checkout)
+ _prcs_arguments \
+ '(-r)--revison=[version of the project]:revision:' \
+ '(--revison)-r[version of the project]:revision:' \
+ '(-p)--preserve[preserve permissions on files that are checked out]' \
+ '(--preserve)-p[preserve permissions on files that are checked out]' \
+ "(-u)--unlink[don't overwrite symbolic link references]" \
+ "(--unlink)-u[don't overwrite symbolic link references]" \
+ "(-P)--exclude-project-file[don't checkout the project file]" \
+ "(--exclude-project-file)-P[don't checkout the project file]" \
+ ':project name:_prcs_projects' \
+ '*:file or directory:_files'
+ ;;
+ config)
+ _prcs_arguments
+ ;;
+ delete)
+ _prcs_arguments \
+ '(-r)--revison=[version of the project]:reversion:' \
+ '(--revison)-r[version of the project]:reversion:' \
+ ':project name:_prcs_projects'
+ ;;
+ depopulate)
+ _prcs_arguments \
+ ':project name:_prcs_projects' \
+ '*:file or directory:_files'
+ ;;
+ diff)
+#
+# FIXME: when there will be a _diff completion function,
+# we should complete with diff options after `--' :
+# prcs diff [OPTION ...] [PROJECT [FILE-OR-DIR ...]] [-- [DIFF-OPTION ...]]
+#
+ _prcs_arguments \
+ '*--revison=[version of the project]:revision:' \
+ '*-r[version of the project]:revision:' \
+ '(-k)--keywords[compare keywords too]' \
+ '(--keywords)-k[compare keywords too]' \
+ '(-N)--new[compare new files against empty files]' \
+ '(--new)-N[compare new files against empty files]' \
+ "(-P)--exclude-project-file[don't diff the project file]" \
+ "(--exclude-project-file)-P[don't diff the project file]" \
+ ':project name:_prcs_projects' \
+ '*:file or directory:_files'
+ ;;
+ execute)
+ _prcs_arguments \
+ '(-r)--revison=[version of the project]:reversion:' \
+ '(--revison)-r[version of the project]:reversion:' \
+ '--pre[list directories first]' \
+ '(--pipe)--all[execute command once, with all files as arguments]' \
+ '(--all)--pipe[supply file contents as the standard input]' \
+ '--match[execute command on files matching a pattern]:pattern:' \
+ '--not[execute command on files not matching a pattern]:pattern:' \
+ '--:command: _command_names -e:*::arguments: _normal' \
+ ':project name:_prcs_projects' \
+ '*:file or directory:_files'
+ ;;
+ info)
+ _prcs_arguments \
+ '(-r)--revison=[version of the project]:revision:' \
+ '(--revison)-r[version of the project]:revision:' \
+ '--sort=[set sorting type]:sorting type:(version date)' \
+ ':project name:_prcs_projects' \
+ '*:file or directory:_files'
+ ;;
+ merge)
+ _prcs_arguments \
+ '(-r)--revison=[version of the project]:revision:' \
+ '(--revison)-r[version of the project]:revision:' \
+ '(-s)--skilled-merge[turn off most of the safety features of merge]' \
+ '(--skilled-merge)-s[turn off most of the safety features of merge]' \
+ "(-u)--unlink[don't overwrite symbolic link references]" \
+ "(--unlink)-u[don't overwrite symbolic link references]" \
+ ':project name:_prcs_projects' \
+ '*:file or directory:_files'
+ ;;
+ package)
+ _prcs_arguments \
+ '(-r)--revison=[version of the project]:revision:' \
+ '(--revison)-r[version of the project]:revision:' \
+ '(-z)--compress=[compress the output]' \
+ '(--compress)-z[compress the output]' \
+ ':project name:_prcs_projects' \
+ ':file:_files'
+ ;;
+ populate)
+ _prcs_arguments \
+ '(-d)--delete=[perform optional deletions]' \
+ '(--delete)-d[perform optional deletions]' \
+ ':project name:_prcs_projects' \
+ '*:file or directory:_files'
+ ;;
+ rekey)
+ _prcs_arguments \
+ "(-u)--unlink[don't overwrite symbolic link references]" \
+ "(--unlink)-u[don't overwrite symbolic link references]" \
+ ':project name:_prcs_projects'
+ ;;
+ unpackage)
+ _prcs_arguments \
+ ':file:_files' \
+ ':project name:_prcs_projects'
+ ;;
+ *)
+ _message "unknown prcs command: $words[2]"
+ ;;
+ esac
+fi
--
Alexandre Duret-Lutz
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2000-01-05 15:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-01-05 15:27 PATCH: new _prcs completion fonction Sven Wischnowsky
-- strict thread matches above, loose matches on Subject: below --
2000-01-05 13:45 Alexandre Duret-Lutz
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).