Skip to content

Commit 595a674

Browse files
committed
feat: generate all of the docs in a script
1 parent 3c1ab57 commit 595a674

18 files changed

+859
-44
lines changed

.cargo/config.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
[alias]
2+
docgen = "run --package docgen --"
3+
14
[target.aarch64-apple-darwin]
25
linker = "rust-lld"
36
# NOTE: `rustdoc` doesn't currently respect the `linker` setting — keep an eye

CLI.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Command-Line Help for `ferrishot`
2+
3+
This document contains the help content for the `ferrishot` command-line program.
4+
5+
**Command Overview:**
6+
7+
- [`ferrishot`](#ferrishot)
8+
9+
## `ferrishot`
10+
11+
A cross-platform desktop screenshot app
12+
13+
**Usage:** `ferrishot [OPTIONS]`
14+
15+
###### **Arguments:**
16+
17+
- `<FILE>` — Instead of taking a screenshot of the desktop, open this image instead
18+
19+
###### **Options:**
20+
21+
- `-r`, `--region <WxH+X+Y>` — Open with a region pre-selected
22+
23+
Format: `<width>x<height>+<top-left-x>+<top-left-y>`
24+
25+
- `-l`, `--last-region` — Use last region
26+
- `-a`, `--accept-on-select <ACTION>` — Accept capture and perform the action as soon as a selection is made
27+
28+
If holding `ctrl` while you are releasing the left mouse button on the first selection,
29+
the behavior is cancelled
30+
31+
It's quite useful to run ferrishot, select a region and have it instantly be copied to the
32+
clipboard for example. In 90% of situations you won't want to do much post-processing of
33+
the region and this makes that experience twice as fast. You can always opt-out with `ctrl`
34+
35+
Using this option with `--region` or `--last-region` will run ferrishot in 'headless mode',
36+
without making a new window.
37+
38+
Possible values:
39+
40+
- `copy`:
41+
Copy image to the clipboard
42+
- `save`:
43+
Save image to a file
44+
- `upload`:
45+
Upload image to the internet
46+
47+
- `-d`, `--delay <MILLISECONDS>` — Wait this long before launch
48+
- `-s`, `--save-path <PATH>` — Instead of opening a file picker to save the screenshot, save it to this path instead
49+
- `-D`, `--dump-default-config` — Write contents of the default config to /home/e/.config/ferrishot.kdl
50+
- `-C`, `--config-file <file.kdl>` — Use the provided config file
51+
52+
Default value: `/home/e/.config/ferrishot.kdl`
53+
54+
- `-S`, `--silent` — Run in silent mode. Do not print anything
55+
- `-j`, `--json` — Print in JSON format

Cargo.lock

Lines changed: 92 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ keywords = ["screenshot", "screen-capture", "capture", "flameshot"]
1010
categories = ["visualization", "multimedia"]
1111
authors = ["Nik Revenco"]
1212

13+
[workspace]
14+
members = [".", "docgen"]
15+
1316
[package.metadata.wix]
1417
upgrade-guid = "338F87CB-7559-4755-9DC7-889308AFCC72"
1518
path-guid = "B2F84121-9832-457D-AD64-A5598BCD4AA7"
@@ -109,14 +112,8 @@ tap = "1.0.1"
109112
# dedents string literals
110113
indoc = "2.0.6"
111114

112-
# `docgen` feature
113-
# generate markdown help for the ferrishot CLI (more details in CONTRIBUTING.md)
114-
clap-markdown = { version = "0.1.5", optional = true }
115115
anstyle = "1.0.10"
116116

117-
[features]
118-
docgen = ["dep:clap-markdown"]
119-
120117
[lints.rust]
121118
missing_docs = "warn"
122119

README.md

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ For reference, see the [default config file (`default.kdl`)](./default.kdl) whic
7575

7676
You can use `ferrishot` in scripts, too
7777

78-
#### ferrishot
78+
#### `ferrishot`
7979

8080
A cross-platform desktop screenshot app
8181

@@ -87,30 +87,41 @@ A cross-platform desktop screenshot app
8787

8888
###### **Options:**
8989

90-
- `--region <WxH+X+Y>`Screenshot region to select
90+
- `-r`, `--region <WxH+X+Y>`Open with a region pre-selected
9191

9292
Format: `<width>x<height>+<top-left-x>+<top-left-y>`
9393

94-
- `--delay <MILLISECONDS>` — Wait this long before launching
95-
- `--save-path <PATH>` — Instead of opening a file picker to save the screenshot, save it to this path instead
96-
- `-a`, `--accept-on-select <ACTION>` — Accept capture as soon as a selection is made
94+
- `-l`, `--last-region` — Use last region
95+
- `-a`, `--accept-on-select <ACTION>` — Accept capture and perform the action as soon as a selection is made
9796

98-
If holding `ctrl` while you are releasing the left mouse button on the
99-
first selection, the behaviour is cancelled
97+
If holding `ctrl` while you are releasing the left mouse button on the first selection,
98+
the behavior is cancelled
99+
100+
It's quite useful to run ferrishot, select a region and have it instantly be copied to the
101+
clipboard for example. In 90% of situations you won't want to do much post-processing of
102+
the region and this makes that experience twice as fast. You can always opt-out with `ctrl`
103+
104+
Using this option with `--region` or `--last-region` will run ferrishot in 'headless mode',
105+
without making a new window.
100106

101107
Possible values:
102108

103109
- `copy`:
104-
Copy the selected region to the clipboard
110+
Copy image to the clipboard
105111
- `save`:
106-
Save the selected region as a file
112+
Save image to a file
107113
- `upload`:
108-
Upload the selected region to the internet
114+
Upload image to the internet
115+
116+
- `-d`, `--delay <MILLISECONDS>` — Wait this long before launch
117+
- `-s`, `--save-path <PATH>` — Instead of opening a file picker to save the screenshot, save it to this path instead
118+
- `-D`, `--dump-default-config` — Write contents of the default config to /home/e/.config/ferrishot.kdl
119+
- `-C`, `--config-file <file.kdl>` — Use the provided config file
109120

110-
- `--dump-default-config` — Write the default config to ~/.config/ferrishot.kdl
111-
- `--config-file <file.kdl>` — Specifies the config file to use
121+
Default value: `/home/e/.config/ferrishot.kdl`
112122

113-
Default value: `~/.config/ferrishot.kdl`
123+
- `-S`, `--silent` — Run in silent mode. Do not print anything
124+
- `-j`, `--json` — Print in JSON format
114125

115126
## Platform Support
116127

completions/_ferrishot

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#compdef ferrishot
2+
3+
autoload -U is-at-least
4+
5+
_ferrishot() {
6+
typeset -A opt_args
7+
typeset -a _arguments_options
8+
local ret=1
9+
10+
if is-at-least 5.2; then
11+
_arguments_options=(-s -S -C)
12+
else
13+
_arguments_options=(-s -C)
14+
fi
15+
16+
local context curcontext="$curcontext" state line
17+
_arguments "${_arguments_options[@]}" : \
18+
'-r+[Open with a region pre-selected]:WxH+X+Y:_default' \
19+
'--region=[Open with a region pre-selected]:WxH+X+Y:_default' \
20+
'-a+[Accept on first selection]:ACTION:((copy\:"Copy image to the clipboard"
21+
save\:"Save image to a file"
22+
upload\:"Upload image to the internet"))' \
23+
'--accept-on-select=[Accept on first selection]:ACTION:((copy\:"Copy image to the clipboard"
24+
save\:"Save image to a file"
25+
upload\:"Upload image to the internet"))' \
26+
'-d+[Wait this long before launch]:MILLISECONDS:_default' \
27+
'--delay=[Wait this long before launch]:MILLISECONDS:_default' \
28+
'-s+[Save image to path]:PATH:_files' \
29+
'--save-path=[Save image to path]:PATH:_files' \
30+
'-C+[Use the provided config file]:file.kdl:_files' \
31+
'--config-file=[Use the provided config file]:file.kdl:_files' \
32+
'--log-level=[Choose a minumum level at which to log]:LOG_LEVEL:_default' \
33+
'--log-file=[Path to the log file]:LOG_FILE:_files' \
34+
'(-r --region)-l[Use last region]' \
35+
'(-r --region)--last-region[Use last region]' \
36+
'-D[Write the default config to /home/e/.config/ferrishot.kdl]' \
37+
'--dump-default-config[Write the default config to /home/e/.config/ferrishot.kdl]' \
38+
'-S[Run in silent mode]' \
39+
'--silent[Run in silent mode]' \
40+
'(-S --silent)-j[Print in JSON format]' \
41+
'(-S --silent)--json[Print in JSON format]' \
42+
'(-S --silent)--log-stdout[Log to stdout instead of file]' \
43+
'--debug[Launch ferrishot in debug mode (F12)]' \
44+
'(-S --silent)--print-log-file-path[Output the path to the log file]' \
45+
'-h[Print help (see more with '\''--help'\'')]' \
46+
'--help[Print help (see more with '\''--help'\'')]' \
47+
'-V[Print version]' \
48+
'--version[Print version]' \
49+
'::file -- Instead of taking a screenshot of the desktop, open this image instead:_files' \
50+
&& ret=0
51+
}
52+
53+
(( $+functions[_ferrishot_commands] )) ||
54+
_ferrishot_commands() {
55+
local commands; commands=()
56+
_describe -t commands 'ferrishot commands' commands "$@"
57+
}
58+
59+
if [ "$funcstack[1]" = "_ferrishot" ]; then
60+
_ferrishot "$@"
61+
else
62+
compdef _ferrishot ferrishot
63+
fi

0 commit comments

Comments
 (0)