zsh-workers
 help / color / mirror / code / Atom feed
* completion for unison
@ 2011-05-12 18:13 Paul Anton Letnes
  2011-05-13  3:13 ` gi1242+zsh
  0 siblings, 1 reply; 3+ messages in thread
From: Paul Anton Letnes @ 2011-05-12 18:13 UTC (permalink / raw)
  To: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 961 bytes --]

Hello!

(This was suggested by someone on #zsh on the freenode network.)

Unison is a very useful file synchronization tool, and works both locally, via ssh or rsync, and others. Unlike (for instance) scp and rsync, unison also handles deletion, ignoring certain files, and a ton of other features. I am not a unison developer, but as a happy user, I recommend it highly at any appropriate opportunity.

I have written a completion script for the command line version of unison (a gui also exists, for those with fear of text commands).  I thought it would be great to share it with the world, so perhaps it will make it into the next zsh release?

Feel free to come with changes or suggestions, as my understanding of the zsh completion system is not as deep as my appreciation of it. I just looked at various examples and built my script from there.

Cheers,
Paul.

PS:
I do not subscribe to this list (yet) so please CC me with any replies.


[-- Attachment #2: _unison --]
[-- Type: application/octet-stream, Size: 4641 bytes --]

#compdef unison

local expl

_unison_profiles() {
    local a
    a=( $HOME/.unison/*.prf(:t) )
    _wanted profiles expl 'Profile names' compadd "$@" -a - a
}

_arguments \
    '-addprefsto xxx [file to add new prefs to]' \
    '-addversionno [add version number to name of unison executable on server]' \
    '-auto [automatically accept default actions]' \
    '-backup xxx [add a pattern to the backup list]' \
    '-backupcurrent xxx [add a pattern to the backupcurrent list]' \
    '-backupcurrentnot xxx [add a pattern to the backupcurrentnot list]' \
    '-backupdir xxx [Directory for storing centralized backups]' \
    "-backuplocation xxx [where backups are stored ('local' or 'central')]" \
    '-backupnot xxx [add a pattern to the backupnot list]' \
    '-backupprefix xxx [prefix for the names of backup files]' \
    "-backups [keep copies of all files (see also 'backup')]" \
    '-backupsuffix xxx [a suffix to be added to names of backup files]' \
    '-batch [batch : ask no questions at all]' \
    '-confirmbigdeletes [request for whole-replica deletes]' \
    '-confirmmerge [ask confirmation before commiting results of a merge]' \
    "-contactquietly [Suppress 'contacting server' message during startup]" \
    "-debug xxx [debug module xxx ('all' -> everything, 'verbose' -> more)]" \
    "-doc xxx [show documentation ('-doc topics' lists topics)]" \
    '-dumbtty [do try to change terminal settings in text UI]' \
    "-fastcheck xxx [do fast update detection ('true', 'false', or 'default')]" \
    '-follow xxx [add a pattern to the follow list]' \
    '-force xxx [force changes from this replica to the other]' \
    '-forcepartial xxx [add a pattern to the forcepartial list]' \
    '-group [synchronize group]' \
    '-height n [height (in lines) of main window in graphical interface]' \
    '-host xxx [bind the socket to this host name in server socket mode]' \
    '-ignore xxx [add a pattern to the ignore list]' \
    "-ignorecase xxx [ignore upper/lowercase in filenames ('true', 'false', or 'default')]" \
    '-ignorelocks        [ignore left over from previous run (dangerous!)]' \
    '-ignorenot xxx [add a pattern to the ignorenot list]' \
    '-immutable xxx [add a pattern to the immutable list]' \
    '-immutablenot xxx [add a pattern to the immutablenot list]' \
    '-key xxx [define a keyboard shortcut for this profile (in some UIs)]' \
    '-killserver [kill when done (even when using sockets)]' \
    '-label xxx [provide a descriptive string label for this profile]' \
    '-log [record in file specified by logfile preference]' \
    '-logfile xxx [Log file name]' \
    '-maxbackups n [number of backed up versions of a file]' \
    '-maxthreads n [maximum number of simultaneous file transfers]' \
    '-merge xxx [add a pattern to the merge list]' \
    '-mountpoint xxx [abort if this path does not exist]' \
    "-numericids [don't map uid/gid values by user/group names]" \
    '-owner [synchronize owner]' \
    '-path xxx [path to synchronize]' \
    '-perms n [part of the permissions which is synchronized]' \
    "-prefer xxx [choose this replica's version for conflicting changes]" \
    '-preferpartial xxx [add a pattern to the preferpartial list]' \
    '-pretendwin [Use times for detecting updates]' \
    '-repeat xxx [synchronize repeatedly (text interface only)]' \
    '-retry n [re-try failed synchronizations N times (text interface only)]' \
    '-root xxx [root of a replica]' \
    '-rootalias xxx [Register alias for canonical root names]' \
    "-rsrc xxx [synchronize resource forks and HFS meta-data ('true', 'false', or 'default')]" \
    '-rsync [activate rsync transfer mode]' \
    '-selftest [run tests and exit]' \
    '-servercmd xxx [name of unison executable on remote server]' \
    "-showarchive [show of archive and 'true names' (for rootalias) of roots]" \
    '-silent [print (except error messages)]' \
    '-socket xxx [act as a server on a socket]' \
    '-sortbysize [list files by size, not name]' \
    '-sortfirst xxx [add a pattern to the sortfirst list]' \
    '-sortlast xxx [add a pattern to the sortlast list]' \
    '-sortnewfirst [list before changed files]' \
    '-sshargs xxx [other arguments (if any) for remote shell command]' \
    '-sshcmd xxx [path to the ssh executable]' \
    '-terse [suppress messages]' \
    '-testserver [exit after the connection to the server]' \
    '-times [synchronize times]' \
    "-ui xxx [select user interface ('text' or 'graphic'); command-line only]" \
    '-version [print and exit]' \
    '-xferbycopying [optimize using local copies, if possible]'

_unison_profiles "$@"



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: completion for unison
  2011-05-12 18:13 completion for unison Paul Anton Letnes
@ 2011-05-13  3:13 ` gi1242+zsh
  2011-05-13  3:16   ` Paul Anton Letnes
  0 siblings, 1 reply; 3+ messages in thread
From: gi1242+zsh @ 2011-05-13  3:13 UTC (permalink / raw)
  To: zsh-workers

On Thu, May 12, 2011 at 11:13:49AM -0700, Paul Anton Letnes wrote:

> I have written a completion script for the command line version of
> unison (a gui also exists, for those with fear of text commands).  I
> thought it would be great to share it with the world, so perhaps it
> will make it into the next zsh release?

I wrote one a few months ago and posted it here. I think Peter
committed it, and it should be already be in the 4.3.11 release.

You can usually save yourself some time by checking the latest Git/SVN
repos before resorting to writing it yourself :).

Regardless, it wouldn't hurt to check if yours has any options that I
might have missed earlier, and send a patch the zsh devs can commit.

GI

-- 
It's a good thing Linux is under GNU General Public Lisense or Microsoft
would buy them out too!


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: completion for unison
  2011-05-13  3:13 ` gi1242+zsh
@ 2011-05-13  3:16   ` Paul Anton Letnes
  0 siblings, 0 replies; 3+ messages in thread
From: Paul Anton Letnes @ 2011-05-13  3:16 UTC (permalink / raw)
  To: gi1242+zsh; +Cc: zsh-workers


On 12. mai 2011, at 20.13, gi1242+zsh@gmail.com wrote:

> On Thu, May 12, 2011 at 11:13:49AM -0700, Paul Anton Letnes wrote:
> 
>> I have written a completion script for the command line version of
>> unison (a gui also exists, for those with fear of text commands).  I
>> thought it would be great to share it with the world, so perhaps it
>> will make it into the next zsh release?
> 
> I wrote one a few months ago and posted it here. I think Peter
> committed it, and it should be already be in the 4.3.11 release.
> 
> You can usually save yourself some time by checking the latest Git/SVN
> repos before resorting to writing it yourself :).
> 
> Regardless, it wouldn't hurt to check if yours has any options that I
> might have missed earlier, and send a patch the zsh devs can commit.
> 
> GI

Aha, good idea. I should have done that.

I don't think I missed any options - I used 'unison -help' and a vim macro to parse the help input into the args list. Anyhow, thanks for letting me know!

Paul.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-05-13  3:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-12 18:13 completion for unison Paul Anton Letnes
2011-05-13  3:13 ` gi1242+zsh
2011-05-13  3:16   ` Paul Anton Letnes

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).