Skip to content

Commit 448b017

Browse files
authored
Add md-to-clip custom completions (#1089)
Resolves #414 * Syntax source https://github.com/command-line-interface-pages/v2-tooling/tree/main/md-to-clip --- I used the descriptions from the Fish completions on the referenced page/docs. ```nushell nu ❯ help md-to-clip Converter from TlDr format to Command Line Interface Pages format. https://github.com/command-line-interface-pages/v2-tooling/tree/main/md-to-clip Usage: > md-to-clip {flags} <file> ...(args) Flags: -h, --help: Display help -v, --version: Display version -a, --author: Display author -e, --email: Display author email --no-file-save: Whether to display conversion result in stdout instead of writing it to a file --output-directory <path>: Directory where conversion result will be written --special-placeholder-config <path>: Config with special placeholders Parameters: file <path>: Source tldr page to convert ...args <external-argument>: all other arguments to the command ```
1 parent d382af3 commit 448b017

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# `md-to-clip` completions
2+
3+
Custom completions for the [`md-to-clip` command line tool](https://github.com/command-line-interface-pages/v2-tooling/tree/main/md-to-clip).
4+
5+
## Usage
6+
7+
Import the custom completions with:
8+
9+
```nushell
10+
source path/to/md-to-clip-completions.nu
11+
```
12+
13+
Afterwards, when you enter `md-to-clip -` and then press tab, the available flags will be displayed:
14+
15+
```nushell
16+
nu ❯ | md-to-clip -
17+
--author Display author
18+
--email Display author email
19+
--help Display help
20+
--no-file-save Whether to display conversion result in stdout instead of writing it to a file
21+
--output-directory Directory where conversion result will be written
22+
--special-placeholder-config Config with special placeholders
23+
--version Display version
24+
-a Display author
25+
-e Display author email
26+
-h Display help
27+
-v Display version
28+
```
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Converter from TlDr format to Command Line Interface Pages format.
2+
# https://github.com/command-line-interface-pages/v2-tooling/tree/main/md-to-clip
3+
export extern "md-to-clip" [
4+
file: path@"nu-complete md-to-clip mdfiles" # Source tldr page to convert
5+
--help (-h) # Display help
6+
--version (-v) # Display version
7+
--author (-a) # Display author
8+
--email (-e) # Display author email
9+
--no-file-save # Whether to display conversion result in stdout instead of writing it to a file
10+
--output-directory : path@"nu-complete md-to-clip dirs" # Directory where conversion result will be written
11+
--special-placeholder-config: path # Config with special placeholders
12+
]
13+
# "old-style long switch" flags are not covered because Nushell does not currently support them https://github.com/nushell/nushell/issues/5959
14+
# `-nfs`, `-od`, `-spc`
15+
16+
def "nu-complete md-to-clip dirs" [] {
17+
ls | where type == 'dir' | get name
18+
}
19+
20+
def "nu-complete md-to-clip mdfiles" [] {
21+
ls | where type == 'dir' or name ends-with '.md' | get name
22+
}

0 commit comments

Comments
 (0)