fork/fish-shell

git clone https://git.julia.blue/fork/fish-shell

Johannes AltmanningerMake __fish_is_nth_token and __fish_nth_token private again47b0d0c29

master
12.3 KiB163 linesraw
1# s3cmd
2
3function __s3cmd_is_remote_path
4    commandline -pct | string match -q -r -- "^s3://.*"
5end
6
7function __s3cmd_is_valid_remote_path
8    commandline -pct | string match -q -r -- "^s3://.*?/.*"
9end
10
11# Completions to allow for autocomplete of remote paths
12complete -c s3cmd -f -n __s3cmd_is_valid_remote_path -a "(s3cmd ls (commandline -ct) 2>/dev/null | string match -r -- 's3://.*')"
13complete -c s3cmd -f -n __s3cmd_is_remote_path
14
15# Suppress file completions for initial command
16complete -c s3cmd -n "__fish_is_nth_token 1" -f
17
18# Available commands
19complete -c s3cmd -n "__fish_is_nth_token 1" -a mb -d 'Make bucket'
20complete -c s3cmd -n "__fish_is_nth_token 1" -a rb -d 'Remove bucket'
21complete -c s3cmd -n "__fish_is_nth_token 1" -a ls -d 'List objects or buckets'
22complete -c s3cmd -n "__fish_is_nth_token 1" -a la -d 'List all object in all buckets'
23complete -c s3cmd -n "__fish_is_nth_token 1" -a put -d 'Put file into bucket'
24complete -c s3cmd -n "__fish_is_nth_token 1" -a get -d 'Get file from bucket'
25complete -c s3cmd -n "__fish_is_nth_token 1" -a del -d 'Delete file from bucket'
26complete -c s3cmd -n "__fish_is_nth_token 1" -a rm -d 'Delete file from bucket (alias for del)'
27complete -c s3cmd -n "__fish_is_nth_token 1" -a restore -d 'Restore file from Glacier storage'
28complete -c s3cmd -n "__fish_is_nth_token 1" -a sync -d 'Synchronize a directory tree to S3'
29complete -c s3cmd -n "__fish_is_nth_token 1" -a du -d 'Disk usage by buckets'
30complete -c s3cmd -n "__fish_is_nth_token 1" -a info -d 'Get various information about Buckets or Files'
31complete -c s3cmd -n "__fish_is_nth_token 1" -a cp -d 'Copy object'
32complete -c s3cmd -n "__fish_is_nth_token 1" -a modify -d 'Modify object metadata'
33complete -c s3cmd -n "__fish_is_nth_token 1" -a mv -d 'Move object'
34complete -c s3cmd -n "__fish_is_nth_token 1" -a setacl -d 'Modify Access control list for Bucket or Files'
35complete -c s3cmd -n "__fish_is_nth_token 1" -a setpolicy -d 'Modify Bucket Policy'
36complete -c s3cmd -n "__fish_is_nth_token 1" -a delpolicy -d 'Delete Bucket Policy'
37complete -c s3cmd -n "__fish_is_nth_token 1" -a setcors -d 'Modify Bucket CORS'
38complete -c s3cmd -n "__fish_is_nth_token 1" -a delcors -d 'Delete Bucket CORS'
39complete -c s3cmd -n "__fish_is_nth_token 1" -a payer -d 'Modify Bucket Requester Pays policy'
40complete -c s3cmd -n "__fish_is_nth_token 1" -a multipart -d 'Show multipart uploads'
41complete -c s3cmd -n "__fish_is_nth_token 1" -a abortmp -d 'Abort a multipart upload'
42complete -c s3cmd -n "__fish_is_nth_token 1" -a listmp -d 'List parts of a multipart upload'
43complete -c s3cmd -n "__fish_is_nth_token 1" -a accesslog -d 'Enable/disable bucket access logging'
44complete -c s3cmd -n "__fish_is_nth_token 1" -a sign -d 'Sign arbitrary string using the secret key'
45complete -c s3cmd -n "__fish_is_nth_token 1" -a signurl -d 'Sign an S3 URL to provide limited public access with expiry'
46complete -c s3cmd -n "__fish_is_nth_token 1" -a fixbucket -d 'Fix invalid file names in a bucket'
47complete -c s3cmd -n "__fish_is_nth_token 1" -a ws-create -d 'Create Website from bucket'
48complete -c s3cmd -n "__fish_is_nth_token 1" -a ws-delete -d 'Delete Website'
49complete -c s3cmd -n "__fish_is_nth_token 1" -a ws-info -d 'Info about Website'
50complete -c s3cmd -n "__fish_is_nth_token 1" -a expire -d 'Set or delete expiration rule for the bucket'
51complete -c s3cmd -n "__fish_is_nth_token 1" -a setlifecycle -d 'Upload a lifecycle policy for the bucket'
52complete -c s3cmd -n "__fish_is_nth_token 1" -a dellifecycle -d 'Remove a lifecycle policy for the bucket'
53complete -c s3cmd -n "__fish_is_nth_token 1" -a cflist -d 'List CloudFront distribution points'
54complete -c s3cmd -n "__fish_is_nth_token 1" -a cfinfo -d 'Display CloudFront distribution point parameters'
55complete -c s3cmd -n "__fish_is_nth_token 1" -a cfcreate -d 'Create CloudFront distribution point'
56complete -c s3cmd -n "__fish_is_nth_token 1" -a cfdelete -d 'Delete CloudFront distribution point'
57complete -c s3cmd -n "__fish_is_nth_token 1" -a cfmodify -d 'Change CloudFront distribution point parameters'
58complete -c s3cmd -n "__fish_is_nth_token 1" -a cfinvalinfo -d 'Display CloudFront invalidation request(s) status'
59
60# Created against s3cmd version 2.0
61complete -c s3cmd -s h -l help -d 'Show help and exit'
62complete -c s3cmd -l configure -d 'Run interactive (re)configuration tool'
63complete -c s3cmd -s c -l config -d 'Config file (default: $HOME/.s3cfg)'
64complete -c s3cmd -l dump-config -d 'Dump current configuration'
65complete -c s3cmd -l access_key -d 'AWS Access Key'
66complete -c s3cmd -l secret_key -d 'AWS Secret Key'
67complete -c s3cmd -l access_token -d 'AWS Access Token'
68complete -c s3cmd -s n -l dry-run -d 'Dry run, test only'
69complete -c s3cmd -s s -l ssl -d 'Use HTTPS (default)'
70complete -c s3cmd -l no-ssl -d 'Don\'t use HTTPS'
71complete -c s3cmd -s e -l encrypt -d 'Encrypt files before uploading'
72complete -c s3cmd -l no-encrypt -d 'Don\'t encrypt files'
73complete -c s3cmd -s f -l force -d 'Force overwrite'
74complete -c s3cmd -l continue -d 'Resume partially downloaded file' -n "__fish_seen_subcommand_from get"
75complete -c s3cmd -l continue-put -d 'Resume partially uploaded files'
76complete -c s3cmd -l upload-id -d 'Resume multipart upload by UploadId'
77complete -c s3cmd -l skip-existing -d 'Skip existing files at destination' -n "__fish_seen_subcommand_from get sync"
78complete -c s3cmd -s r -l recursive -d 'Upload/download/delete recursively'
79complete -c s3cmd -l check-md5 -d 'Check MD5 sums (default)' -n "__fish_seen_subcommand_from sync"
80complete -c s3cmd -l no-check-md5 -d 'Skip MD5 sum check' -n "__fish_seen_subcommand_from sync"
81complete -c s3cmd -s P -l acl-public -d 'Store with ACL read for all'
82complete -c s3cmd -l acl-private -d 'Store with private ACL'
83complete -c s3cmd -l acl-grant -d 'Grant permission to named user'
84complete -c s3cmd -l acl-revoke -d 'Revoke permission to named user'
85complete -c s3cmd -s D -l restore-days -d 'Days to keep restored file'
86complete -c s3cmd -l restore-priority -d 'S3 glacier restore priority'
87complete -c s3cmd -l delete-removed -d 'Delete objects not found locally' -n "__fish_seen_subcommand_from sync"
88complete -c s3cmd -l no-delete-removed -d 'Don\'t delete dest objects'
89complete -c s3cmd -l delete-after -d 'Delete after upload' -n "__fish_seen_subcommand_from sync"
90complete -c s3cmd -l max-delete -d 'Delete no more than NUM files' -n "__fish_seen_subcommand_from del sync"
91complete -c s3cmd -l limit -d 'Max objects per response' -n "__fish_seen_subcommand_from ls la"
92complete -c s3cmd -l add-destination -d 'Additional parallel upload'
93complete -c s3cmd -l delete-after-fetch -d 'Delete remotely after fetch' -n "__fish_seen_subcommand_from get sync"
94complete -c s3cmd -s p -l preserve -d 'Preserve FS attributes'
95complete -c s3cmd -l no-preserve -d 'Don\'t store FS attributes'
96complete -c s3cmd -l exclude -d 'Exclude GLOB matches'
97complete -c s3cmd -l exclude-from -d '--exclude GLOBs from FILE'
98complete -c s3cmd -l rexclude -d 'Exclude REGEXP matches'
99complete -c s3cmd -l rexclude-from -d 'Read --rexclude REGEXPs from FILE'
100complete -c s3cmd -l include -d 'Include GLOB matches even if previously excluded'
101complete -c s3cmd -l include-from -d 'Read --include GLOBs from FILE'
102complete -c s3cmd -l rinclude -d 'Include REGEXP matches even if preiously excluded'
103complete -c s3cmd -l rinclude-from -d 'Read --rinclude REGEXPs from FILE'
104complete -c s3cmd -l files-from -d 'Read source-file names from FILE'
105complete -c s3cmd -l region -l bucket-location -d 'Create bucket in region'
106complete -c s3cmd -l host -d 'S3 endpoint (default: s3.amazonaws.com)'
107complete -c s3cmd -l host-bucket -d 'DNS-style bucket+hostname:port template for bucket'
108complete -c s3cmd -l reduced-redundancy -l rr -d 'Store with reduced redundancy' -n "__fish_seen_subcommand_from put cp mv"
109complete -c s3cmd -l no-reduced-redundancy -l no-rr -d 'Store without reduced redundancy' -n "__fish_seen_subcommand_from put cp mv"
110complete -c s3cmd -l storage-class -d 'Store with STANDARD, STANDARD_IA, or REDUCED_REDUNDANCY'
111complete -c s3cmd -l access-logging-target-prefix -d 'Prefix for access logs' -n "__fish_seen_subcommand_from cfmodify accesslog"
112complete -c s3cmd -l no-access-logging -d 'Disable access logging' -n "__fish_seen_subcommand_from cfmodify accesslog"
113complete -c s3cmd -l default-mime-type -d 'Default MIME-type for objects'
114complete -c s3cmd -s M -l guess-mime-type -d 'Guess MIME-type'
115complete -c s3cmd -l no-guess-mime-type -d 'Don\'t guess MIME-type, use default'
116complete -c s3cmd -l no-mime-magic -d 'Don\'t use mime magic when guessing'
117complete -c s3cmd -s m -l mime-type -d 'Force MIME-type'
118complete -c s3cmd -l add-header -d 'Add HTTP header'
119complete -c s3cmd -l remove-header -d 'Remove HTTP header'
120complete -c s3cmd -l server-side-encryption -d 'Use server-side encryption for upload'
121complete -c s3cmd -l server-side-encryption-kms-id -d 'Encrypt with specified AWS KMS-managed key'
122complete -c s3cmd -l encoding -d 'Use specified encoding'
123complete -c s3cmd -l add-encoding-exts -d 'Add encoding to CSV extension list'
124complete -c s3cmd -l verbatim -d 'Use S3 name as-is'
125complete -c s3cmd -l disable-multipart -d 'No multipart on files larger than --multipart-chunk-size-mb'
126complete -c s3cmd -l multipart-chunk-size-mb -d 'Multipart upload chunk size'
127complete -c s3cmd -l list-md5 -d 'Include MD5 sums in bucket listings' -n "__fish_seen_subcommand_from ls"
128complete -c s3cmd -s H -l human-readable-sizes -d 'Print sizes in human-readable form'
129complete -c s3cmd -l ws-index -d 'Name of index-document' -n "__fish_seen_subcommand_from ws-create"
130complete -c s3cmd -l ws-error -d 'Name of error-document' -n "__fish_seen_subcommand_from ws-create"
131complete -c s3cmd -l expiry-date -d 'When expiration rule takes effect' -n "__fish_seen_subcommand_from expire"
132complete -c s3cmd -l expiry-days -d 'Days to expire' -n "__fish_seen_subcommand_from expire"
133complete -c s3cmd -l expiry-prefix -d 'Apply expiry to objects matching prefix' -n "__fish_seen_subcommand_from expire"
134complete -c s3cmd -l progress -d 'Show progress (default on TTY)'
135complete -c s3cmd -l no-progress -d 'Don\'t show progress meter (default if non-TTY)'
136complete -c s3cmd -l stats -d 'Show file transfer stats'
137complete -c s3cmd -l enable -d 'Enable CloudFront distribution' -n "__fish_seen_subcommand_from cfmodify"
138complete -c s3cmd -l disable -d 'Disable CloudFront distribution' -n "__fish_seen_subcommand_from cfmodify"
139complete -c s3cmd -l cf-invalidate -d 'Invalidate CloudFront file' -n "__fish_seen_subcommand_from cfmodify"
140complete -c s3cmd -l cf-invalidate-default-index -d 'Invalidate default index' -n "__fish_seen_subcommand_from cfmodify"
141complete -c s3cmd -l cf-no-invalidate-default-index-root -d 'Don\'t invalidate default index' -n "__fish_seen_subcommand_from cfmodify"
142complete -c s3cmd -l cf-add-cname -d 'Add CNAME to CloudFront distribution' -n "__fish_seen_subcommand_from cfcreate cfmodify"
143complete -c s3cmd -l cf-remove-cname -d 'Remove CNAME from CloudFront distribution' -n "__fish_seen_subcommand_from cfmodify"
144complete -c s3cmd -l cf-comment -d 'Set COMMENT for CloudFront distribution' -n "__fish_seen_subcommand_from cfcreate cfmodify"
145complete -c s3cmd -l cf-default-root-object -d 'Set default root object' -n "__fish_seen_subcommand_from cfcreate cfmodify"
146complete -c s3cmd -s v -l verbose -d 'Verbose output'
147complete -c s3cmd -s d -l debug -d 'Debug output'
148complete -c s3cmd -l version -d 'Show version'
149complete -c s3cmd -s F -l follow-symlinks -d 'Follow symlinks'
150complete -c s3cmd -l cache-file -d 'Cache FILE containing MD5 values'
151complete -c s3cmd -s q -l quiet -d 'Silence stdout output'
152complete -c s3cmd -l ca-certs -d 'Path to SSL CA certificate FILE'
153complete -c s3cmd -l check-certificate -d 'Validate SSL certificate'
154complete -c s3cmd -l no-check-certificate -d 'Don\'t validate SSL certificate'
155complete -c s3cmd -l check-hostname -d 'Validate SSL hostname'
156complete -c s3cmd -l no-check-hostname -d 'Don\'t validate SSL hostname'
157complete -c s3cmd -l signature-v2 -d 'Use AWS Signature version 2'
158complete -c s3cmd -l limit-rate -d 'Limit upload or download speed (bytes/sec)'
159complete -c s3cmd -l requester-pays -d 'Set REQUESTER PAYS for operations'
160complete -c s3cmd -s l -l long-listing -d 'Produce long listing' -n "__fish_seen_subcommand_from ls"
161complete -c s3cmd -l stop-on-error -d 'Stop on error in transfer'
162complete -c s3cmd -l content-disposition -d 'Provide Content-Disposition for signed URLs'
163complete -c s3cmd -l content-type -d 'Provide Content-Type for signed URLs'