Skip to content

Commit 9891ab0

Browse files
authored
Update shell completion and manpage (flameshot-org#4140)
* update the shell completions to include everything in --help of each subcommand * re-arrange and update the manpage
1 parent 5c12dc5 commit 9891ab0

File tree

4 files changed

+101
-76
lines changed

4 files changed

+101
-76
lines changed

data/man/man1/flameshot.1

Lines changed: 32 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,14 @@ If no argument is provided, it will open the config window, otherwise it can cha
8383
Here we list all the arguments available for all subcommands. The subcommands that accept each argument are listed after each argument. Alternatively, you can use the \fBflameshot [subcommand] --help\fR to know the list of available arguments for each subcommand.
8484
.
8585
.PP
86+
\-s, \-\-accept-on-select
87+
.RS 4
88+
Accept capture as soon as a selection is made
89+
.br
90+
Valid for subcommands: gui
91+
.RE
92+
.
93+
.PP
8694
\-a, \-\-autostart <bool>
8795
.RS 4
8896
Enable or disable run at startup
@@ -107,6 +115,14 @@ Valid for subcommands: full, gui, screen
107115
.RE
108116
.
109117
.PP
118+
\-k, \-\-contrastcolor <color-code>
119+
.RS 4
120+
Define the contrast UI color
121+
.br
122+
Valid for subcommands: config
123+
.RE
124+
.
125+
.PP
110126
\-d, \-\-delay <milliseconds>
111127
.RS 4
112128
How many milliseconds should Flameshot wait before taking the screenshot
@@ -123,14 +139,6 @@ Valid for subcommands: config
123139
.RE
124140
.
125141
.PP
126-
\-g, \-\-print-geometry
127-
.RS 4
128-
Print geometry of the selection in the format WxH+X+Y. Does nothing if raw is specified
129-
.br
130-
Valid for subcommands: gui
131-
.RE
132-
.
133-
.PP
134142
\-h, \-\-help
135143
.RS 4
136144
Show a brief help message and list the arguments the valid arguments for that subcommand
@@ -139,25 +147,25 @@ Valid for subcommands: config, full, gui, launcher, screen
139147
.RE
140148
.
141149
.PP
142-
\-k, \-\-contrastcolor <color-code>
150+
\-\-last-region
143151
.RS 4
144-
Define the contrast UI color
152+
Repeat screenshot with previously selected region
145153
.br
146-
Valid for subcommands: config
154+
Valid for subcommands: gui
147155
.RE
148156
.
149157
.PP
150-
\-\-last-region
158+
\-m, \-\-maincolor <color-code>
151159
.RS 4
152-
Repeat screenshot with previously selected region
160+
Define the main UI color
153161
.br
154-
Valid for subcommands: full, gui, screen
162+
Valid for subcommands: config
155163
.RE
156164
.
157165
.PP
158-
\-m, \-\-maincolor <color-code>
166+
\-n, \-\-notifications
159167
.RS 4
160-
Define the main UI color
168+
Enable or disable the notifications
161169
.br
162170
Valid for subcommands: config
163171
.RE
@@ -187,27 +195,27 @@ Valid for subcommands: gui, screen
187195
.RE
188196
.
189197
.PP
190-
\-r, \-\-raw
198+
\-g, \-\-print-geometry
191199
.RS 4
192-
Send raw PNG to stdout
200+
Print geometry of the selection in the format WxH+X+Y. Does nothing if raw is specified
193201
.br
194-
Valid for subcommands: full, gui, screen
202+
Valid for subcommands: gui
195203
.RE
196204
.
197205
.PP
198-
\-\-region <WxH+X+Y or string>
206+
\-r, \-\-raw
199207
.RS 4
200-
Screenshot region to select
208+
Send raw PNG to stdout
201209
.br
202210
Valid for subcommands: full, gui, screen
203211
.RE
204212
.
205213
.PP
206-
\-s, \-\-accept-on-select
214+
\-\-region <WxH+X+Y or string>
207215
.RS 4
208-
Accept capture as soon as a selection is made
216+
Screenshot region to select
209217
.br
210-
Valid for subcommands: gui
218+
Valid for subcommands: full, gui, screen
211219
.RE
212220
.
213221
.PP

data/shell-completion/flameshot.bash

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,18 @@
44
# To be installed in "/usr/share/bash-completion/completions/flameshot"
55
# and "/usr/share/zsh/site-functions/"
66

7+
78
_flameshot() {
89
local prev cur cmd gui_opts full_opts config_opts
910
COMPREPLY=()
1011

1112
prev="${COMP_WORDS[COMP_CWORD-1]}"
1213
cur="${COMP_WORDS[COMP_CWORD]}"
1314
cmd="gui full config launcher screen"
14-
screen_opts="--number --path --delay --raw --last-region -p -d -r -n"
15-
gui_opts="--path --delay --raw --last-region -p -d -r"
16-
full_opts="--path --delay --clipboard --raw --last-region -p -d -c -r"
17-
config_opts="--contrastcolor --filename --maincolor --showhelp --trayicon --autostart -k -f -m -s -t -a"
15+
screen_opts="--number -n --path -p --clipboard -c --delay -d --region --raw -r --upload -u --pin --help"
16+
gui_opts="--path -p --clipboard -c --delay -d --region --last-region --raw -r --print-geometry -g --upload -u --pin --accept-on-select -s --help"
17+
full_opts="--path -p --clipboard -c --delay -d --region --raw -r --upload -u --help"
18+
config_opts="--autostart -a --filename -f --notifications -n --trayicon -t --showhelp -s --maincolor -m --contrastcolor -k --check"
1819

1920
case "${prev}" in
2021
launcher)
@@ -40,7 +41,8 @@ _flameshot() {
4041
_filedir -d
4142
return 0
4243
;;
43-
-s|--showhelp|-t|--trayicon)
44+
# TODO: We should see how we can add the -n (for `config --notifications`) here that does not conflict with -n (for `screen --number`)
45+
-a|--autostart|-s|--showhelp|-t|--trayicon|--notifications)
4446
COMPREPLY=( $(compgen -W "true false" -- "${cur}") )
4547
return 0
4648
;;

data/shell-completion/flameshot.fish

Lines changed: 51 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
set -l SUBCOMMANDS gui screen full launcher config
21

32
####################
43
# HELPER FUNCTIONS #
@@ -67,48 +66,61 @@ end
6766
# COMPLETIONS #
6867
###############
6968

69+
# define the subcommands
70+
set -l SUBCOMMANDS gui screen full launcher config
71+
7072
# No subcommand
71-
complete -c flameshot -n __flameshot_no_positional_args -f -a "$SUBCOMMANDS"
72-
complete -c flameshot -l "help" -s "h" -f -d "Display help message"
73-
complete -c flameshot -l "version" -s "v" -f -d "Display version information" -n __flameshot_no_positional_args
73+
complete -c flameshot --no-files --arguments "$SUBCOMMANDS" --condition __flameshot_no_positional_args
74+
complete -c flameshot --long-option "help" --short-option "h" --description "Display help message" --no-files
75+
complete -c flameshot --long-option "version" --short-option "v" --description "Display version information" --no-files --condition __flameshot_no_positional_args
7476

7577
# GUI subcommand
76-
__flameshot_complete gui -f
77-
__flameshot_complete gui -l "path" -s "p" -rk -d "Output file or directory"
78-
__flameshot_complete gui -l "clipboard" -s "c" -f -d "Copy screenshot to the clipboard"
79-
__flameshot_complete gui -l "delay" -s "d" -frk -d "Delay time in milliseconds"
80-
__flameshot_complete gui -l "region" -frk -d "Screenshot region to select (WxH+X+Y)" -a "(__flameshot_complete_region gui)"
81-
__flameshot_complete gui -l "last-region" -f -d "Repeat screenshot with previously selected region"
82-
__flameshot_complete gui -l "raw" -s "r" -f -d "Print raw PNG capture"
83-
__flameshot_complete gui -l "print-geometry" -s "g" -f -d "Print geometry of the selection"
84-
__flameshot_complete gui -l "upload" -s "u" -f -d "Upload the screenshot"
85-
__flameshot_complete gui -l "pin" -f -d "Pin the screenshot to the screen"
86-
__flameshot_complete gui -l "accept-on-select" -s "s" -f -d "Accept capture as soon as a selection is made"
78+
__flameshot_complete gui --no-files
79+
__flameshot_complete gui --long-option "path" --short-option "p" --description "Output file or directory" --require-parameter
80+
__flameshot_complete gui --long-option "clipboard" --short-option "c" --description "Copy screenshot to the clipboard" --no-files
81+
__flameshot_complete gui --long-option "delay" --short-option "d" --description "Delay time in milliseconds" --require-parameter --no-files
82+
__flameshot_complete gui --long-option "region" --description "Screenshot region to select (WxH+X+Y)" --require-parameter --arguments "(__flameshot_complete_region gui)"
83+
__flameshot_complete gui --long-option "last-region" --description "Repeat screenshot with previously selected region" --no-files
84+
__flameshot_complete gui --long-option "raw" --short-option "r" --description "Print raw PNG capture" --no-files
85+
__flameshot_complete gui --long-option "print-geometry" --short-option "g" --description "Print geometry of the selection" --no-files
86+
__flameshot_complete gui --long-option "upload" --short-option "u" --description "Upload the screenshot" --no-files
87+
__flameshot_complete gui --long-option "pin" --description "Pin the screenshot to the screen" --no-files
88+
__flameshot_complete gui --long-option "accept-on-select" --short-option "s" --description "Accept capture as soon as a selection is made" --no-files
89+
__flameshot_complete gui --long-option "help" --short-option "h" --description "Show the available arguments" --no-files
8790

8891
# SCREEN subcommand
89-
__flameshot_complete screen -f
90-
__flameshot_complete screen -l "number" -s "n" -frk -d "Screen number (starting from 0)" -a "(__flameshot_complete_screen_number)"
91-
__flameshot_complete screen -l "path" -s "p" -rk -d "Output file or directory"
92-
__flameshot_complete screen -l "clipboard" -s "c" -f -d "Copy screenshot to the clipboard"
93-
__flameshot_complete screen -l "delay" -s "d" -frk -d "Delay time in milliseconds"
94-
__flameshot_complete screen -l "region" -frk -d "Screenshot region to select (WxH+X+Y)" -a "(__flameshot_complete_region screen)"
95-
__flameshot_complete screen -l "last-region" -f -d "Repeat screenshot with previously selected region"
96-
__flameshot_complete screen -l "raw" -s "r" -f -d "Print raw PNG capture"
97-
__flameshot_complete screen -l "upload" -s "u" -f -d "Upload the screenshot"
98-
__flameshot_complete screen -l "pin" -f -d "Pin the screenshot to the screen"
92+
__flameshot_complete screen --no-files
93+
__flameshot_complete screen --long-option "number" --short-option "n" --description "Screen number (starting from 0)" --require-parameter --no-files --arguments "(__flameshot_complete_screen_number)"
94+
__flameshot_complete screen --long-option "path" --short-option "p" --description "Output file or directory" --require-parameter
95+
__flameshot_complete screen --long-option "clipboard" --short-option "c" --description "Copy screenshot to the clipboard" --no-files
96+
__flameshot_complete screen --long-option "delay" --short-option "d" --description "Delay time in milliseconds" --require-parameter --no-files
97+
__flameshot_complete screen --long-option "region" --description "Screenshot region to select (WxH+X+Y)" --require-parameter --no-files --arguments "(__flameshot_complete_region screen)"
98+
__flameshot_complete screen --long-option "raw" --short-option "r" --description "Print raw PNG capture" --no-files
99+
__flameshot_complete screen --long-option "upload" --short-option "u" --description "Upload the screenshot" --no-files
100+
__flameshot_complete screen --long-option "pin" --description "Pin the screenshot to the screen" --no-files
101+
__flameshot_complete screen --long-option "help" --short-option "h" --description "Show the available arguments" --no-files
99102

100103
# FULL command
101-
__flameshot_complete full -f
102-
__flameshot_complete full -l "path" -s "p" -rk -d "Output file or directory"
103-
__flameshot_complete full -l "clipboard" -s "c" -f -d "Copy screenshot to the clipboard"
104-
__flameshot_complete full -l "delay" -s "d" -frk -d "Delay time in milliseconds"
105-
__flameshot_complete full -l "region" -frk -d "Screenshot region to select (WxH+X+Y)" -a "(__flameshot_complete_region full)"
106-
__flameshot_complete full -l "last-region" -f -d "Repeat screenshot with previously selected region"
107-
__flameshot_complete full -l "raw" -s "r" -f -d "Print raw PNG capture"
108-
__flameshot_complete full -l "upload" -s "u" -f -d "Upload the screenshot"
109-
110-
# LAUNCHER command doesn't have any completions specific to itself
111-
112-
# CONFIG command -- TODO will be completed in a future version
113-
__flameshot_complete config -f
114-
__flameshot_complete config -l "check" -f -d "Check the configuration for errors"
104+
__flameshot_complete full --no-files
105+
__flameshot_complete full --long-option "path" --short-option "p" --description "Output file or directory" --require-parameter
106+
__flameshot_complete full --long-option "clipboard" --short-option "c" --description "Copy screenshot to the clipboard" --no-files
107+
__flameshot_complete full --long-option "delay" --short-option "d" --description "Delay time in milliseconds" --require-parameter --no-files
108+
__flameshot_complete full --long-option "region" --description "Screenshot region to select (WxH+X+Y)" --require-parameter --no-files --arguments "(__flameshot_complete_region full)" --keep-order
109+
__flameshot_complete full --long-option "raw" --short-option "r" --description "Print raw PNG capture" --no-files
110+
__flameshot_complete full --long-option "upload" --short-option "u" --description "Upload the screenshot" --no-files
111+
__flameshot_complete full --long-option "help" --short-option "h" --description "Show the available arguments" --no-files
112+
113+
# LAUNCHER command
114+
__flameshot_complete launcher --no-files
115+
116+
# CONFIG command
117+
__flameshot_complete config --no-files
118+
__flameshot_complete config --long-option "autostart" --short-option "a" --description "Enable or disable run at startup" --require-parameter --no-files --arguments "true false"
119+
__flameshot_complete config --long-option "filename" --short-option "f" --description "Set the filename pattern" --require-parameter --no-files
120+
__flameshot_complete config --long-option "notification" --short-option "n" --description "Enable or disable the notification" --require-parameter --no-files --arguments "true false"
121+
__flameshot_complete config --long-option "trayicon" --short-option "t" --description "Enable or disable the tray icon" --require-parameter --no-files --arguments "true false"
122+
__flameshot_complete config --long-option "showhelp" --short-option "s" --description "Show the help message in the capture mode" --require-parameter --no-files --arguments "true false"
123+
__flameshot_complete config --long-option "maincolor" --short-option "m" --description "Define the main UI color (hexadecimal)" --require-parameter --no-files
124+
__flameshot_complete config --long-option "contrastcolor" --short-option "k" --description "Define the contrast UI color (hexadecimal)" --require-parameter --no-files
125+
__flameshot_complete config --long-option "check" --description "Check the configuration for errors" --no-files
126+
__flameshot_complete config --long-option "help" --short-option "h" --description "Show the available arguments" --no-files

data/shell-completion/flameshot.zsh

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ _flameshot_gui_opts=(
2727
{-u,--upload}'[Upload screenshot]'
2828
"--pin[Pin the capture to the screen]"
2929
{-s,--accept-on-select}'[Accept capture as soon as a selection is made]'
30+
{-h,--help}'[Show the available arguments]'
3031
)
3132

3233
_flameshot_gui() {
@@ -43,10 +44,10 @@ _flameshot_screen_opts=(
4344
{-c,--clipboard}'[Save the capture to the clipboard]'
4445
{-d,--delay}'[Delay time in milliseconds]'
4546
"--region[Screenshot region to select <WxH+X+Y or string>]"
46-
"--last-region[Repeat screenshot with previously selected region]"
4747
{-r,--raw}'[Print raw PNG capture]'
4848
{-u,--upload}'[Upload screenshot]'
4949
"--pin[Pin the capture to the screen]"
50+
{-h,--help}'[Show the available arguments]'
5051
)
5152

5253
_flameshot_screen() {
@@ -62,9 +63,9 @@ _flameshot_full_opts=(
6263
{-c,--clipboard}'[Save the capture to the clipboard]'
6364
{-d,--delay}'[Delay time in milliseconds]'
6465
"--region[Screenshot region to select <WxH+X+Y or string>]"
65-
"--last-region[Repeat screenshot with previously selected region]"
6666
{-r,--raw}'[Print raw PNG capture]'
6767
{-u,--upload}'[Upload screenshot]'
68+
{-h,--help}'[Show the available arguments]'
6869
)
6970

7071
_flameshot_full() {
@@ -76,13 +77,15 @@ _flameshot_full() {
7677
# config
7778

7879
_flameshot_config_opts=(
79-
{-a,--autostart}'[Enable or disable run at startup]'
80+
{-a,--autostart}'[Enable or disable run at startup (true/false)]'
8081
{-f,--filename}'[Set the filename pattern]'
81-
{-t,--trayicon}'[Enable or disable the tray icon]'
82-
{-s,--showhelp}'[Define the main UI color]'
83-
{-m,--maincolor}'[Show the help message in the capture mode]'
84-
{-k,--contrastcolor}'[Define the contrast UI color]'
82+
{-n,--notification}'[Enable or disable the notification (true/false)]'
83+
{-t,--trayicon}'[Enable or disable the tray icon (true/false)]'
84+
{-s,--showhelp}'[Show the help message in the capture mode (true/false)]'
85+
{-m,--maincolor}'[Define the main UI color (hexadecimal)]'
86+
{-k,--contrastcolor}'[Define the contrast UI color (hexadecimal)]'
8587
"--check[Check the configuration for errors]"
88+
{-h,--help}'[Show the available arguments]'
8689
)
8790

8891
_flameshot_config() {
@@ -97,7 +100,7 @@ _flameshot() {
97100
local -a state line commands
98101

99102
commands=(
100-
"gui:Start a manual capture in GUI mode"
103+
"gui:Start the manual capture in GUI mode"
101104
"screen:Capture a single screen (one monitor)"
102105
"full:Capture the entire desktop (all monitors)"
103106
"launcher:Open the capture launcher"

0 commit comments

Comments
 (0)