fork/fish-shell
git clone https://git.julia.blue/fork/fish-shell
b31b77cf8
master
1# Fish completions for Perforce (p4) SCM 2# Based on the list of commands from 3# https://www.perforce.com/perforce/r16.1/manuals/cmdref/ 4# Author: Boris Aranovich https://github.com/nomaed 5 6######################################################### 7### p4 command parsing 8######################################################### 9 10function __fish_print_p4_client_name -d"Use `p4 info` output to query for current client name" 11set -l p4info( p4 info -s2> /dev/null) 12if string match -qr'^Client unknown' $p4info 13return 14end 15string match -r'^Client name: .+' $p4info | string replace'Client name: ' '' 16end 17 18######################################################### 19 20function __fish_print_p4_user_name -d"Use `p4 info` output to query for current client name" 21string match -r'^User name: .+' ( p4 info2> /dev/null) | string replace'User name: ' '' 22end 23 24######################################################### 25 26function __fish_print_p4_changelists -d"Reformat output from `p4 changes` to simple format. Specify 'detailed!' as first argument to use username@workspace prefix" 27set -l detailed 28if test -n " $argv " 29and test $argv [ 1 ] = "detailed!" 30set detailed true 31set -e argv[ 1 ] 32end 33 34# The format of `p4 changes -L` is as follows, for each changelist: 35# Change 1234 on YYYY/MM/DD by user@workspace *status*\n 36# \n 37# \t Description text line\n 38# \t Description text another line\n 39# \n 40set -l changes( p4 changes -L$argv ) 41 42set -l result 43for linein ( string trim --$changes ) 44if test -z " $line " 45continue 46end 47# see output format ^^^ 48set -l change_match( string match -ar'^Change ([0-9]+) on [0-9/]+ by (\S+).*$' --$line ) 49if test -n " $change_match " 50if test -n " $result " 51echo $result 52set result 53end 54set result$change_match [ 2 ] \t 55if test -n " $detailed " 56set result$result $change_match [ 3 ] : 57end 58else 59set -a result$line 60end 61end 62 63if test -n " $result " 64echo $result 65end 66end 67 68######################################################### 69 70function __fish_print_p4_opened_files -d"Use `p4 diff` to output the names of all opened files" 71# p4 opened -s | sed 's/#.*//' | p4 -x - where | awk '/^\// {print $3}' 72# p4 opened -s | string replace -ar '(^\S+).*$' '$1' | p4 -x - where | string replace -ar '\S+\s\S+\s(\S+)' '$1' 73string replace -a" $PWD /" '' ( p4 diff -sa -sb -sr) 74end 75 76######################################################### 77 78function __fish_print_p4_branches -d"Prints the list of all defined branches on the server" 79set -l branches( p4 branches) 80for branchin $branches 81# "Branch branch-name YYYY/MM/DD 'description text'" 82set -l matches( string match -ar'^Branch\s+(\S+)[^\']+\'(.+)\'$' $branch ) 83if not set -q matches[ 2 ] 84# skip $branch if no match for branch name with description 85continue 86end 87# matches[2] = branch name; matches[3] = description 88echo -n$matches [ 2 ] 89if not set -q matches[ 3 ] 90echo -n\t $matches [ 3 ] 91end 92echo 93end 94end 95 96######################################################### 97 98function __fish_print_p4_streams 99# I do not have an example of p4 streams output 100#p4 streams 2> /dev/null 101end 102 103######################################################### 104 105function __fish_print_p4_users -d"Lists perforce users suitable for list of completions" 106# `p4 users` output format: 107# "username <email@address> (Full Name) accessed YYYY/MM/DD" 108# function will output it as: 109# username[TAB]Full Name <email@address> 110string replace -ar'(^\S+) <([^>]+)> \(([^\)]+)\).*$' '$1'\t'$3 <$2>' ( p4 users) 111end 112 113######################################################### 114 115function __fish_print_p4_workspaces -d"Lists current user's workspaces" 116set -l user( __fish_print_p4_user_name ) 117if test -z " $user " 118return 119end 120# "Client clientname YYYY/MM/DD root /home/user/workspace/path 'description text'" 121string replace -ar'^Client (\S+) \S+ root (\S+) \'(.+)\'$' '$1'\t'$3' ( p4 clients -u$user ) 122end 123 124######################################################### 125 126function __fish_print_p4_workspace_changelists -d"Lists all changelists for current user" 127set -l client( __fish_print_p4_client_name ) 128if test -n " $client " 129__fish_print_p4_changelists -c$client $argv 130end 131end 132 133######################################################### 134 135function __fish_print_p4_pending_changelists -d"Lists all *pending* changelists. If 'default' argument is provided, default changelist will also be listed" 136if set -q argv[ 1 ] 137and test $argv [ 1 ] = default 138echo default\t Default changelist 139end 140__fish_print_p4_workspace_changelists -s pending 141end 142 143######################################################### 144 145function __fish_print_p4_shelved_changelists -d"Lists all changelists with *shelved* files" 146__fish_print_p4_workspace_changelists -s shelved 147end 148 149######################################################### 150### completion helpers 151######################################################### 152 153function __fish_print_p4_commands_list -d"Lists p4 commands" 154set -l commands add annotate attribute branch branches change changes changelist changelists clean client clients copy counter counters cstat delete depot depots describe diff diff2 dirs edit filelog files fix fixes flush fstat grep group groups have help info integ integrate integrated interchanges istat job jobs key keys label labels labelsync list lock logger login logout merge move opened passwd populate print protect protects prune rec reconcile rename reopen resolve resolved revert review reviews set shelve status sizes stream streams submit sync tag tickets unlock unshelve update user users where workspace workspaces 155for iin $commands 156echo $i 157end 158end 159 160######################################################### 161 162function __fish_print_p4_env_vars -d"Lists environment variables that can be consumed by perforce" 163set -l env_vars P4CLIENT P4PORT P4PASSWD P4USER P4CONFIG P4DIFF P4EDITOR P4MERGE P4CHARSET P4TRUST P4PAGER PWD TMP TEMP P4TICKETS P4LANGUAGE P4LOGINSSO P4COMMANDCHARSET P4DIFFUNICODE P4MERGEUNICODE P4CLIENTPATH P4AUDIT P4JOURNAL P4LOG P4PORT P4ROOT P4DEBUG P4NAME P4SSLDIR 164for varin $env_vars 165echo $var 166end 167end 168 169######################################################### 170 171function __fish_print_p4_file_types -d"Lists all of available file modes" 172set -l base_types text binary symlink apple resource unicode utf16 173for typein $base_types 174printf '%s\t%s\n' $type +m'always set modtime' $type +w'always writeable' $type +x'exec bit set' $type +k'$Keyword$ expansion of Id, Header, Author, Date, DateUTC, DateTime, DateTimeUTC, DateTimeTZ, Change, File, Revision' $type +ko'$Keyword$ expansion of Id, Header only' $type +l'exclusive open: disallow multiple opens' $type +C'server stores compressed file per revision' $type +D'server stores deltas in RCS format' $type +F'server stores full file per revision' $type +S'server stores only single head rev., or specify number to <n> of revisions' $type +X'server runs archive trigger to access files' 175end 176end 177 178######################################################### 179 180function __fish_print_p4_help_keywords -d"Keywords for `p4 help`" 181echo administration\t"Help on specialized administration topics" 182echo charset\t"Describes how to control Unicode translation" 183echo commands\t"Lists all the Perforce commands" 184echo configurables\t"Describes all of the server configuration variables" 185echo dvcs\t"Describes decentralized version control with Perforce" 186echo environment\t"Lists the Perforce environment variables and their meanings" 187echo filetypes\t"Lists the Perforce filetypes and their meanings" 188echo jobview\t"Describes Perforce jobviews" 189echo legal\t"Legal and license information" 190echo networkaddress\t"Help on network address syntax" 191echo replication\t"Describes specialized replication topics" 192echo revisions\t"Describes Perforce revision specifiers" 193echo simple\t"Provides short descriptions of the eight most basic Perforce commands" 194echo usage\t"Lists the six options available with all Perforce commands" 195echo views\t"Describes the meaning of Perforce views" 196end 197 198######################################################### 199 200function __fish_print_p4_diff_options -d"Options for `p4 diff -d`" 201echo n\t"RCS output format, showing additions and deletions made to the file and associated line ranges" 202echo c\t"context output format, showing line number ranges and N lines of context around the changes" # 203echo s\t"summary output format, showing only the number of chunks and lines added, deleted, or changed" 204echo u\t"unified output format, showing added and deleted lines with N lines of context, in a form compatible with the patch(1) utility" # 205echo l\t"ignore line-ending (CR/LF) convention when finding diffs" 206echo b\t"ignore changes made within whitespace; this option implies -dl" 207echo w\t"ignore whitespace altogether; this option implies -dl" 208end 209 210######################################################### 211 212function __fish_print_p4_resolve_options -d"Options for `p4 merge` using -a, -A and -d" 213switch " $argv [ 1 ] " 214case a 215echo m\t"Automatic: accept the Perforce-recommended file revision (yours, their, merge)" 216echo y\t"Accept Yours, ignore theirs" 217echo t\t"Accept Theirs" 218echo s\t"Safe Accept: merge if no conflict, ignore file otherwise" 219echo f\t"Force Accept: conflicted changes will leave conflict markers in the file" 220case A 221echo b\t"Resolve attributes set by p4 attribute" 222echo b\t"Resolve file branching; that is, integrations where the source is edited and the target is deleted" 223echo c\t"Resolve file content changes" 224echo d\t"Integrations where the source is deleted and target is deleted" 225echo t\t"Filetype changes" 226echo m\t"Move and renames" 227case d 228echo b\t"Ignore whitespace-only changes (for instance, a tab replaced by eight spaces)" 229echo w\t"Ignore whitespace altogether (for instance, deletion of tabs or other whitespace)" 230echo l\t"Ignore differences in line-ending convention" 231end 232end 233 234######################################################### 235 236function __fish_print_p4_parallel_options -d"Values for --parallel option in various commands" 237set -l mode 238if test -n " $argv " 239set mode$argv [ 1 ] 240end 241 242# for now only looks that mode is set, later it will need to have a specific setting 243echo 'threads='\t"sends files concurrently using N independent network connections" 244echo 'batch='\t"specifies the number of files in a batch" 245test -n " $mode " 246or echo 'batchsize='\t"specifies the number of bytes in a batch" 247echo 'min='\t"specifies the minimum number of files in a parallel sync" 248test -n " $mode " 249or echo 'minsize='\t"specifies the minimum number of bytes in a parallel sync" 250end 251 252######################################################### 253 254function __fish_print_p4_submit_options -d"Options for `p4 submit`" 255echo 'submitunchanged'\t"Submit all open files (default behavior)" 256echo 'submitunchanged+reopen'\t"Submit all open files + reopen to default changelist" 257echo 'revertunchanged'\t"Revert unmodified files, submit all the rest" 258echo 'revertunchanged+reopen'\t"Revert unmodified files, submit all the rest + reopen them in default changelist" 259echo 'leaveunchanged'\t"Move unchanged files to default changelist, submit all the rest" 260echo 'leaveunchanged+reopen'\t"Submit only modified files + reopen all (modified and unmodified) in default changelist" 261end 262 263######################################################### 264 265function __fish_print_p4_noretransfer_options -d"Options for `p4 submit --noretransfer`" 266echo 1 \t"server avoids re-transferring files that have already been archived after a failed submit operation" 267echo 0 \t"server re-transfers all files after a failed submit operation" 268end 269 270######################################################### 271 272function __fish_print_p4_integrate_output_options -d"Options for `p4 resolve -O`" 273echo b\t"outputs the base revision for the merge (if any)" 274echo r\t"outputs the resolves that are being scheduled" 275end 276 277######################################################### 278 279function __fish_print_p4_integrate_resolve_options -d"Options for `p4 resolve -R`" 280echo b\t"schedules a branch resolve instead of branching the target files automatically" 281echo d\t"schedules a delete resolve instead of deleting the target files automatically" 282echo s\t"skips cherry-picked revisions that have already been integrated" 283end 284 285######################################################### 286 287function __fish_p4_not_in_command -d"Checks that prompt is not inside of p4 command" 288for iin ( commandline -xpc) 289if contains --$i ( __fish_print_p4_commands_list ) 290return 1 291end 292end 293return 0 294end 295 296######################################################### 297 298# Perforce command is a single word that comes either as first argument 299# or directly after global options. 300# To test whether we're in command, it's enough that a command will appear 301# in the arguments, even though if more than a single command is specified, 302# p4 will complain. 303function __fish_p4_is_using_command -d"Checks if prompt is in a specific command" 304if contains --$argv [ 1 ] ( commandline -xpc) 305return 0 306end 307return 1 308end 309 310######################################################### 311 312function __fish_p4_register_command -d"Adds a completion for a specific command" 313complete -c p4 -n __fish_p4_not_in_command -a$argv [ 1 ] $argv [ 2 .. -1 ] 314end 315 316######################################################### 317 318function __fish_p4_register_command_option -d"Adds a specific option for a command" 319complete -c p4 -n"__fish_p4_is_using_command $argv [ 1 ] " $argv [ 2 .. -1 ] 320end 321 322######################################################### 323### global options -- can be used before any command 324######################################################### 325 326complete -c p4 -n __fish_p4_not_in_command -s b -x -d'Number of arguments when using -x flag' 327complete -c p4 -n __fish_p4_not_in_command -s c -x -d'Overrides P4CLIENT settings' 328complete -c p4 -n __fish_p4_not_in_command -s d -r -d'Overrides PWD settings' 329complete -c p4 -n __fish_p4_not_in_command -s I -d'Show process indicators' 330complete -c p4 -n __fish_p4_not_in_command -s G -d'python dict in/output' 331complete -c p4 -n __fish_p4_not_in_command -s H -x -a'(__fish_print_hostnames)' -d'Overrides P4HOST settings' 332complete -c p4 -n __fish_p4_not_in_command -s p -x -d'Overrides P4PORT settings' 333complete -c p4 -n __fish_p4_not_in_command -s P -x -d'Overrides P4PASSWD settings' 334complete -c p4 -n __fish_p4_not_in_command -s r -x -d'Number of retry attempts' 335complete -c p4 -n __fish_p4_not_in_command -s s -d'Prefix for each line' 336complete -c p4 -n __fish_p4_not_in_command -s u -x -a'(__fish_print_p4_users)' -d'Overrides P4USER/USER/USERNAME settings' 337complete -c p4 -n __fish_p4_not_in_command -s x -r -d'Read arguments from file' 338complete -c p4 -n __fish_p4_not_in_command -s C -x -a'(__fish_print_encodings)' -d'Overrides P4CHARSET settings' 339complete -c p4 -n __fish_p4_not_in_command -s Q -x -a'(__fish_print_encodings)' -d'Overrides P4COMMANDCHARSET settings' 340complete -c p4 -n __fish_p4_not_in_command -s L -x -d'Feature reserved for system integrators' 341complete -c p4 -n __fish_p4_not_in_command -s z -x -d'fstat output' 342complete -c p4 -n __fish_p4_not_in_command -s q -d'Quiet mode' 343complete -c p4 -n __fish_p4_not_in_command -s V -d'Display version' 344complete -c p4 -n __fish_p4_not_in_command -s h -d'Display help' 345 346######################################################### 347### sub-commands 348######################################################### 349 350__fish_p4_register_command add -d"Open a new file to add it to the depot" 351__fish_p4_register_command annotate -d"Print file lines along with their revisions" 352__fish_p4_register_command attribute -f -d"Set per-revision attributes on revisions" 353__fish_p4_register_command branch -f -d"Create or edit a branch specification" 354__fish_p4_register_command branches -f -d"Display list of branches" 355__fish_p4_register_command change -f -d"Create or edit a changelist description" 356__fish_p4_register_command changes -f -d"Display list of pending and submitted changelists" 357__fish_p4_register_command changelist -f -d"Create or edit a changelist description" 358__fish_p4_register_command changelists -f -d"Display list of pending and submitted changelists" 359__fish_p4_register_command clean -d"Delete or refresh local files to match depot state" 360__fish_p4_register_command client -f -d"Create or edit a client specification and its view" 361__fish_p4_register_command clients -f -d"Display list of known clients" 362__fish_p4_register_command copy -d"Schedule copy of latest rev from one file to another" 363__fish_p4_register_command counter -f -d"Display, set, or delete a counter" 364__fish_p4_register_command counters -f -d"Display list of known counters" 365__fish_p4_register_command cstat -f -d"Dump change/sync status for current client" 366__fish_p4_register_command delete -d"Open an existing file to delete it from the depot" 367__fish_p4_register_command depot -f -d"Create or edit a depot specification" 368__fish_p4_register_command depots -f -d"Display list of depots" 369__fish_p4_register_command describe -x -d"Display a changelist description" 370__fish_p4_register_command diff -d"Display diff of client file with depot file" 371__fish_p4_register_command diff2 -d"Display diff of two depot files" 372__fish_p4_register_command dirs -f -d"List subdirectories of a given depot directory" 373__fish_p4_register_command edit -d"Open an existing file for edit" 374__fish_p4_register_command filelog -d"List revision history of files" 375__fish_p4_register_command files -d"List files in the depot" 376__fish_p4_register_command fix -f -d"Mark jobs as being fixed by named changelists" 377__fish_p4_register_command fixes -f -d"List what changelists fix what job" 378__fish_p4_register_command flush -d"Fake a 'p4 sync' by not moving files" 379__fish_p4_register_command fstat -d"Dump file info" 380__fish_p4_register_command grep -d"Print lines from text files matching a pattern" 381__fish_p4_register_command group -f -d"Change members of a user group" 382__fish_p4_register_command groups -f -d"List groups (of users)" 383__fish_p4_register_command have -f -d"List revisions last synced" 384__fish_p4_register_command help -f -d"Print the requested help message" 385__fish_p4_register_command info -f -d"Print out client/server information" 386__fish_p4_register_command integ -d"Schedule integration from one file to another" 387__fish_p4_register_command integrate -d"Schedule integration from one file to another" 388__fish_p4_register_command integrated -f -d"Show integrations that have been submitted" 389__fish_p4_register_command interchanges -f -d"Report changes that have not yet been integrated" 390__fish_p4_register_command istat -f -d"Show integrations needed for a stream" 391__fish_p4_register_command job -f -d"Create or edit a job (defect) specification" 392__fish_p4_register_command jobs -f -d"Display list of jobs" 393__fish_p4_register_command key -f -d"Display, set, or delete a key/value pair" 394__fish_p4_register_command keys -f -d"Display list of known keys and their values" 395__fish_p4_register_command label -f -d"Create or edit a label specification and its view" 396__fish_p4_register_command labels -f -d"Display list of labels" 397__fish_p4_register_command labelsync -f -d"Synchronize label with the current client contents" 398__fish_p4_register_command list -d"Create an in-memory (label) list of depot files" 399__fish_p4_register_command lock -d"Lock an opened file against changelist submission" 400__fish_p4_register_command logger -f -d"Report what jobs and changelists have changed" 401__fish_p4_register_command login -f -d"Login to Perforce by obtaining a session ticket" 402__fish_p4_register_command logout -f -d"Logout of Perforce by removing or invalidating a ticket" 403__fish_p4_register_command merge -d"Schedule merge (integration) from one file to another" 404__fish_p4_register_command move -d"Moves files from one location to another" 405__fish_p4_register_command opened -d"Display list of files opened for pending changelist" 406__fish_p4_register_command passwd -f -d"Set the user's password on the server (and Windows client)" 407__fish_p4_register_command populate -d"Populate a branch or stream with files" 408__fish_p4_register_command print -d"Retrieve a depot file to the standard output" 409__fish_p4_register_command protect -f -d"Modify protections in the server namespace" 410__fish_p4_register_command protects -f -d"Display protections in place for a given user/path" 411__fish_p4_register_command prune -d"Remove unmodified branched files from a stream" 412__fish_p4_register_command rec -f -d"Reconcile client to offline workspace changes" 413__fish_p4_register_command reconcile -f -d"Reconcile client to offline workspace changes" 414__fish_p4_register_command rename -d"Moves files from one location to another" 415__fish_p4_register_command reopen -d"Change the type or changelist number of an opened file" 416__fish_p4_register_command resolve -d"Merge open files with other revisions or files" 417__fish_p4_register_command resolved -d"Show files that have been merged but not submitted" 418__fish_p4_register_command revert -d"Discard changes from an opened file" 419__fish_p4_register_command review -f -d"List and track changelists (for the review daemon)" 420__fish_p4_register_command reviews -d"Show what users are subscribed to review files" 421__fish_p4_register_command set -x -d"Set variables in the registry (Windows only)" 422__fish_p4_register_command shelve -x -d"Store files from a pending changelist into the depot" 423__fish_p4_register_command status -f -d"Preview reconcile of client to offline workspace changes" 424__fish_p4_register_command sizes -d"Display size information for files in the depot" 425__fish_p4_register_command stream -f -d"Create or edit a stream specification" 426__fish_p4_register_command streams -f -d"Display list of streams" 427__fish_p4_register_command submit -d"Submit open files to the depot" 428__fish_p4_register_command sync -f -d"Synchronize the client with its view of the depot" 429__fish_p4_register_command tag -d"Tag files with a label" 430__fish_p4_register_command tickets -f -d"Display list of session tickets for this user" 431__fish_p4_register_command unlock -d"Release a locked file but leave it open" 432__fish_p4_register_command unshelve -d"Restore shelved files from a pending changelist" 433__fish_p4_register_command update -f -d"Update the client with its view of the depot" 434__fish_p4_register_command user -f -d"Create or edit a user specification" 435__fish_p4_register_command users -f -d"Display list of known users" 436__fish_p4_register_command where -d"Show how file names map through the client view" 437__fish_p4_register_command workspace -f -d"Create or edit a client specification and its view" 438__fish_p4_register_command workspaces -f -d"Display list of known clients" 439 440######################################################### 441### sub-command options 442######################################################### 443 444#----------------------------------------------------- 445#--> Help 446#----------------------------------------------------- 447 448# help 449__fish_p4_register_command_option help -f -a'(__fish_print_p4_help_keywords)' 450 451# info 452__fish_p4_register_command_option info -s s -d"Short output (removes information that requires DB search)" 453 454#----------------------------------------------------- 455#--> Client workspace 456#----------------------------------------------------- 457 458# clean 459__fish_p4_register_command_option clean -a'(__fish_print_p4_opened_files)' 460__fish_p4_register_command_option clean -s a -d"Delete files not in depot" 461__fish_p4_register_command_option clean -s d -d"Restore deleted files" 462__fish_p4_register_command_option clean -s e -d"Restore edited files" 463__fish_p4_register_command_option clean -s I -d"Ignore P4IGNORE settings for added files" 464__fish_p4_register_command_option clean -s l -d"Display output in local file syntax with relative paths" 465__fish_p4_register_command_option clean -s n -d"Preview what would be done" 466 467# client, workspace @TODO: -Fs (only in -f), -c (only in -S stream) 468for ain client workspace 469__fish_p4_register_command_option $a -x -a'(__fish_print_p4_workspaces)' 470__fish_p4_register_command_option $a -s f -d"Allows the last modification date to be set" 471__fish_p4_register_command_option $a -s d -f -a'(__fish_print_p4_workspaces)' -d"Delete client workspace even if not owned by user" 472# __fish_p4_register_command_option $a -a '-Fs' -d 'Deletes client with shelves (must follow -f)' 473__fish_p4_register_command_option $a -s F -a s -d'Deletes client with shelves (must follow -f)' 474__fish_p4_register_command_option $a -s o -d"Write the client workspace spec to standard output" 475__fish_p4_register_command_option $a -s i -d"Read the client workspace spec from standard input" 476__fish_p4_register_command_option $a -s c -x -a'(__fish_print_p4_workspace_changelists)' -d"When used with -S stream, preview the workspace spec" 477__fish_p4_register_command_option $a -s s -d"Switch workspace view" 478__fish_p4_register_command_option $a -s t -x -d"Specify a client workspace Template" 479__fish_p4_register_command_option $a -l serverid -x -d"Forcefully delete workspace that is bound to another server" 480__fish_p4_register_command_option $a -s S -x -a'(__fish_print_p4_streams)' -d"Associates the workspace with the specified stream" 481end 482 483# clients, workspaces @TODO -U and others are mutually exclusive 484for ain clients workspaces 485__fish_p4_register_command_option $a -s a -d"List all client workspaces" 486__fish_p4_register_command_option $a -s e -x -d"List client workspaces matching filter (case-sensitive)" 487__fish_p4_register_command_option $a -s E -x -d"List client workspaces matching filter (case-insensitive)" 488__fish_p4_register_command_option $a -s m -x -d"List the first max client workspaces" 489__fish_p4_register_command_option $a -s s -x -d"List client workspaces bound to the specified serverID" 490__fish_p4_register_command_option $a -s S -x -a'(__fish_print_p4_streams)' -d"List client workspaces associated with the specified stream" 491__fish_p4_register_command_option $a -s t -d"Display time and date last update to the workspace" 492__fish_p4_register_command_option $a -s u -x -a'(__fish_print_p4_users)' -d"List only client workspaces owned by user" 493__fish_p4_register_command_option $a -s U -d"List only client workspaces unloaded with p4 unload" 494end 495 496# flush @TODO 497# have @TODO 498# ignores @TODO 499 500# sync @TODO --parallel has unique key-value pair syntax: --parallel=optq1=n,opt2=n,opt3=n,opt4=n 501__fish_p4_register_command_option sync -s f -d"Force sync, overwrite all unopened files" 502__fish_p4_register_command_option sync -s k -d"Keep existing workspace files, alias for p4 flush" 503__fish_p4_register_command_option sync -s L -d"Perform sync on a list of valid file arguments" 504__fish_p4_register_command_option sync -s m -x -d"Sync only the first max files specified" 505__fish_p4_register_command_option sync -s n -d"Display sync results without actually syncing" 506__fish_p4_register_command_option sync -s N -d"Display network traffic estimates without actually syncing" 507__fish_p4_register_command_option sync -s p -d"Populate a client workspace, but don't update the have list" 508__fish_p4_register_command_option sync -l parallel -x -a'(__fish_print_p4_parallel_options)' -d"Specify options for parallel file transfer" 509__fish_p4_register_command_option sync -s q -d"Quiet operation: suppress normal output messages" 510__fish_p4_register_command_option sync -s r -d"Reopen files mapped to new locations, in the new location" 511__fish_p4_register_command_option sync -s s -d"Compare client workspace against what was last synced" 512 513# update @TODO 514# where @TODO 515 516#----------------------------------------------------- 517#--> Files 518#----------------------------------------------------- 519 520# add 521__fish_p4_register_command_option add -s c -x -a'(__fish_print_p4_pending_changelists default)' -d"Changelist number" 522__fish_p4_register_command_option add -s d -d"Revert and re-add" 523__fish_p4_register_command_option add -s f -d"Use wildcard characters for files" 524__fish_p4_register_command_option add -s I -d"Do not use P4IGNORE" 525__fish_p4_register_command_option add -s n -d"Preview operation, don't change files" 526__fish_p4_register_command_option add -s t -x -a'(__fish_print_p4_file_types)' -d"File type" 527 528# attribute @TODO 529# copy @TODO 530# delete @TODO 531# diff @TODO 532# diff2 @TODO 533# dirs @TODO 534 535# edit 536__fish_p4_register_command_option edit -s c -x -a'(__fish_print_p4_pending_changelists default)' -d"Changelist number" 537__fish_p4_register_command_option edit -s k -d"Keep existing workspace files; mark file as open for edit" 538__fish_p4_register_command_option edit -s n -d"Preview operation, don't change files" 539__fish_p4_register_command_option edit -s t -x -a'(__fish_print_p4_file_types)' -d"File type" 540 541# files @TODO 542# fstat @TODO 543# grep @TODO 544# move @TODO 545# lock @TODO 546# print @TODO 547# reconcile @TODO 548# rename @TODO 549# revert @TODO 550# status @TODO 551# sizes @TODO 552# unlock @TODO 553 554#----------------------------------------------------- 555#--> Changelists 556#----------------------------------------------------- 557 558# change, changelist 559for ain change changelist 560__fish_p4_register_command_option $a -x -a'(__fish_print_p4_pending_changelists)' 561__fish_p4_register_command_option $a -s s -d"Allows jobs to be assigned any status values on submission" 562__fish_p4_register_command_option $a -s f -d"Force operation" 563__fish_p4_register_command_option $a -s u -d"Update a submitted changelist" 564__fish_p4_register_command_option $a -s O -x -a'(__fish_print_p4_pending_changelists)' -d"Changelist number" 565__fish_p4_register_command_option $a -s d -x -a'(__fish_print_p4_pending_changelists)' -d"Delete a changelist" 566__fish_p4_register_command_option $a -s o -d"Writes the changelist spec to standard output" 567__fish_p4_register_command_option $a -s i -d"Read the changelist spec from standard input" 568__fish_p4_register_command_option $a -s t -x -a"restricted public" -d"Modifies the 'Type' of the change" 569__fish_p4_register_command_option $a -s U -x -a'(__fish_print_p4_users)' -d"Changes the 'User' of the change" 570end 571 572# changes, changelists 573for ain changes changelists 574__fish_p4_register_command_option $a -s i -d"Include changelists of integrated, affected files" 575__fish_p4_register_command_option $a -s t -d"Display the time as well as the date of each change" 576__fish_p4_register_command_option $a -s l -d"List long output, with full changelist" 577__fish_p4_register_command_option $a -s L -d"List long output, with full changelist (truncated)" 578__fish_p4_register_command_option $a -s f -d"View restricted changes (requires admin permission)" 579__fish_p4_register_command_option $a -c c -x -a'(__fish_print_p4_workspace_changelists)' -d"List only changes made from the named client workspace" 580__fish_p4_register_command_option $a -c m -x -d"List only the highest numbered max changes" 581__fish_p4_register_command_option $a -c s -x -a'pending submitted shelved' -d"Limit the list to the changelists with the given status" 582__fish_p4_register_command_option $a -c u -x -a'(__fish_print_p4_users)' -d"List only changes made from the named user" 583 584end 585 586# describe @TODO: -dc<n>, -du<n> 587__fish_p4_register_command_option describe -x -a'(__fish_print_p4_workspace_changelists)' 588__fish_p4_register_command_option describe -s f -d'Force display of descriptions for restricted changelists' 589__fish_p4_register_command_option describe -s O -d'Specify the original changelist number' 590__fish_p4_register_command_option describe -s s -d'Short output without diffs' 591__fish_p4_register_command_option describe -s S -d'Display shelved files with diffs' 592__fish_p4_register_command_option describe -s d -x -a'(__fish_print_p4_diff_options)' -d Diff 593 594# filelog @TODO 595 596# opened 597__fish_p4_register_command_option opened -s a -d"List opened files in all client workspaces" 598__fish_p4_register_command_option opened -s c -x -a'(__fish_print_p4_pending_changelists default)' -d"List the files in a pending changelist" 599__fish_p4_register_command_option opened -s C -x -a'(__fish_print_p4_workspaces)' -d"List files that are open in the specified client workspace" 600__fish_p4_register_command_option opened -s m -x -d"List only the first max open files" 601__fish_p4_register_command_option opened -s s -d"Short output; don't output the revision number or file type" 602__fish_p4_register_command_option opened -s u -x -a'(__fish_print_p4_users)' -d"List only those files that were opened by user" 603__fish_p4_register_command_option opened -s x -d"List all files that have the +l filetype over all servers" 604 605# reopen 606__fish_p4_register_command_option reopen -x -a'(__fish_print_p4_opened_files)' -d"Select opened files" 607__fish_p4_register_command_option reopen -s c -x -a'(__fish_print_p4_pending_changelists default)' -d"Move files to changelist" 608__fish_p4_register_command_option reopen -s t -x -a'(__fish_print_p4_file_types)' -d"Change file type" 609 610# review @TODO 611 612# shelve 613__fish_p4_register_command_option shelve -a'(__fish_print_p4_opened_files)' 614__fish_p4_register_command_option shelve -s a -x -a'submitunchanged leaveunchanged' -d"Choose which files to shelve" 615__fish_p4_register_command_option shelve -s c -x -a'(__fish_print_p4_pending_changelists)' -d"Changelist number" 616__fish_p4_register_command_option shelve -s d -d'Discard the shelved files' 617__fish_p4_register_command_option shelve -s f -d'Force overwrite of shelved files' 618__fish_p4_register_command_option shelve -s i -d'Read a changelist description from standard input' 619__fish_p4_register_command_option shelve -s p -d"Promote shelved change from Edge server to Commit server" 620__fish_p4_register_command_option shelve -s r -d'Replace shelved files in changelist with opened files' 621 622# submit @TODO: parallel syntax 623__fish_p4_register_command_option submit -a'(__fish_print_p4_opened_files)' 624__fish_p4_register_command_option submit -s c -x -a'(__fish_print_p4_pending_changelists)' -d"Submit specific changelist" 625__fish_p4_register_command_option submit -s d -x -d"Submit changelist and bypass interactive form" 626__fish_p4_register_command_option submit -s e -x -a'(__fish_print_p4_shelved_changelists)' -d"Submit specific shelved changelist" 627__fish_p4_register_command_option submit -s f -x -a'(__fish_print_p4_submit_options)' -d"Override the SubmitOptions setting in the p4 client form" 628__fish_p4_register_command_option submit -s i -d"Read a changelist specification from standard input" 629__fish_p4_register_command_option submit -l noretransfer -x -a'(__fish_print_p4_noretransfer_options)' 630__fish_p4_register_command_option submit -l parallel -x -a'(__fish_print_p4_parallel_options "submit")' -d"Specify options for parallel file transfer" 631__fish_p4_register_command_option submit -s r -d"Reopen files for edit in default changelist" 632__fish_p4_register_command_option submit -s s -d"Allow jobs to be assigned arbitrary status values" 633 634# unshelve @TODO: Streams 635__fish_p4_register_command_option unshelve -s b -x -a'(__fish_print_p4_branches)' -d"Specifies a branch spec for unshelving from" 636__fish_p4_register_command_option unshelve -s c -x -a'(__fish_print_p4_pending_changelists)' -d"Changelist number into which to unshelve" 637__fish_p4_register_command_option unshelve -s f -d'Force the overwriting of writable (but unopened) files' 638__fish_p4_register_command_option unshelve -s n -d"Preview result of unshelve operation" 639__fish_p4_register_command_option unshelve -s P -x -a'(__fish_print_p4_streams)' -d"Unshelve to the specified parent stream" 640__fish_p4_register_command_option unshelve -s s -x -a'(__fish_print_p4_shelved_changelists)' -d"Specify the source shelved pending changelist number" 641__fish_p4_register_command_option unshelve -s S -x -a'(__fish_print_p4_streams)' -d"Specifies a stream spec for unshelving from" 642 643#----------------------------------------------------- 644#--> Jobs 645#----------------------------------------------------- 646 647# fix @TODO 648# fixes @TODO 649# job @TODO 650# jobs @TODO 651# jobspec @TODO 652 653#----------------------------------------------------- 654#--> Branching and Merging 655#----------------------------------------------------- 656 657# branch @TODO 658# branches @TODO 659# copy @TODO 660# cstat @TODO 661 662# integ, integrate @TODO -s fromFile is based on -b branchname, try resolving 663for ain integ integrate 664__fish_p4_register_command_option $a -s b -x -a'(__fish_print_p4_branches)' -d"Integrate files using sourceFile/targetFile mappings" 665__fish_p4_register_command_option $a -s n -d"Preview the integrations" 666__fish_p4_register_command_option $a -s v -d"Open files for branching without copying toFiles" 667__fish_p4_register_command_option $a -s c -x -a'(__fish_print_p4_pending_changelists)' -d"Open the toFiles in the specified pending changelist" 668__fish_p4_register_command_option $a -s q -d"Quiet mode" 669__fish_p4_register_command_option $a -a -Di -d"If file is deleted and re-added, consider it the same file" 670__fish_p4_register_command_option $a -s f -d"Force integration on all revisions of fromFile and toFile" 671__fish_p4_register_command_option $a -s h -d"Use the have revision" 672__fish_p4_register_command_option $a -s O -x -a'(__fish_print_p4_integrate_output_options)' -d"Specify output options" 673__fish_p4_register_command_option $a -s m -x -d"Limit the command to integrating only the first N files" 674__fish_p4_register_command_option $a -s R -x -a'(__fish_print_p4_integrate_resolve_options)' -d"Specify resolve options" 675__fish_p4_register_command_option $a -s s -r -d"Source file and revision" 676__fish_p4_register_command_option $a -s r -r -d"Reverse the mappings in the branch view" 677__fish_p4_register_command_option $a -s S -x -a'(__fish_print_p4_streams)' -d"Source stream" 678__fish_p4_register_command_option $a -s P -x -a'(__fish_print_p4_streams)' -d"Custom parent stream" 679end 680 681# integrated @TODO 682# interchanges @TODO 683# istat @TODO 684# label @TODO 685# labels @TODO 686# labelsync @TODO 687# list @TODO 688# merge @TODO 689# populate @TODO 690# tag @TODO 691 692# resolve 693__fish_p4_register_command_option resolve -s a -x -a'(__fish_print_p4_resolve_options a)' -d"Resolve automatically" 694__fish_p4_register_command_option resolve -s A -x -a'(__fish_print_p4_resolve_options A)' -d"Constrain the type of resolve" 695__fish_p4_register_command_option resolve -s d -x -a'(__fish_print_p4_resolve_options d)' -d"Ignore whitespace/line-ending convention" 696__fish_p4_register_command_option resolve -s f -d"Re-resolve already resolved files if they're not submitted" 697__fish_p4_register_command_option resolve -s n -d"List files that need resolving" 698__fish_p4_register_command_option resolve -s N -d"Preview based on scheduled non-content resolve actions" 699__fish_p4_register_command_option resolve -s o -d"Show base file name and revision on resolve" 700__fish_p4_register_command_option resolve -s t -d"Force a three-way merge, even on binary (non-text) files" 701__fish_p4_register_command_option resolve -s v -d"Include conflict markers in the file" 702__fish_p4_register_command_option resolve -s c -x -a'(__fish_print_p4_workspace_changelists)' -d"Limit scope of resolve based on specified changelist number" 703 704# resolved @TODO 705# stream @TODO 706# streams @TODO 707 708#----------------------------------------------------- 709#--> Administration 710#----------------------------------------------------- 711 712# admin @TODO 713# archive @TODO 714# cachepurge @TODO 715# configure @TODO 716# counter @TODO 717# counters @TODO 718# dbschema @TODO 719# dbstat @TODO 720# depot @TODO 721# depots @TODO 722# diskspace @TODO 723# journals @TODO 724# key @TODO 725# keys @TODO 726# license @TODO 727# lockstat @TODO 728# logappend @TODO 729# logger @TODO 730# logparse @TODO 731# logrotate @TODO 732# logschema @TODO 733# logstat @TODO 734# logtail @TODO 735# monitor @TODO 736# obliterate @TODO 737# ping @TODO 738# property @TODO 739# proxy @TODO 740# pull @TODO 741# reload @TODO 742# renameuser @TODO 743# replicate @TODO 744# restore @TODO 745# reviews @TODO 746# server @TODO 747# serverid @TODO 748# servers @TODO 749# triggers @TODO 750# typemap @TODO 751# unload @TODO 752# verify @TODO 753 754#----------------------------------------------------- 755#--> Security 756#----------------------------------------------------- 757 758# group @TODO 759# groups @TODO 760# login @TODO 761# logout @TODO 762# passwd @TODO 763# protect @TODO 764# protects @TODO 765# tickets @TODO 766# trust @TODO 767# user @TODO 768# users @TODO 769 770#----------------------------------------------------- 771#--> Environment 772#----------------------------------------------------- 773 774# set 775__fish_p4_register_command_option set -x -a'(__fish_print_p4_env_vars)' 776__fish_p4_register_command_option set -s q -d"Reduce the output" 777__fish_p4_register_command_option set -s s -d"Set value of the registry variable for the local machine" 778__fish_p4_register_command_option set -s S -x -d"Set value of the registry variables as used by the service"