Skip to content

Commit 249be18

Browse files
authored
fix: Updating commands by manually testing every single one. (#1942)
* chore: adding and tested the commands for alias * fix: updating more docs * fix: providing a better host format * fix: documentation for zoo auth logout * fix: updating documentation * fix: broken documentation on cat file convert * fix: documenting working snapshot and fixing broken snapshot commands * fix: zoo file volume command fixes * fix: updating more broken commands * fix: updating zoo file density * fix: documented zoo kcl export * fix: zoo kcl snapshot documentation * fix: zoo kcl view documentation * fix: zoo kcl analyze documentation * fix: zoo kcl volume documentation * fix: zoo kcl bounding-box documentation * fix: zoo kcl mass documentation * fix: center of mass documentation * fix: zoo kcl density * fix: zoo kcl surface-area documentation * fix: zoo kcl lint documented * fix: zoo ml kcl copilot documentation * fix: more documentation
1 parent bb58d57 commit 249be18

10 files changed

Lines changed: 286 additions & 126 deletions

File tree

‎src/cmd_alias.rs‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ impl crate::cmd::Command for CmdAlias {
3333
}
3434

3535
/// Delete an alias.
36+
///
37+
/// ```shell
38+
/// zoo alias delete aabb_mm
39+
/// ```
40+
///
3641
#[derive(Parser, Debug, Clone)]
3742
#[clap(verbatim_doc_comment)]
3843
pub struct CmdAliasDelete {
@@ -88,6 +93,13 @@ impl crate::cmd::Command for CmdAliasDelete {
8893
/// If the expansion starts with "!" or if "--shell" was given, the expansion is a shell
8994
/// expression that will be evaluated through the "sh" interpreter when the alias is
9095
/// invoked. This allows for chaining multiple commands via piping and redirection.
96+
///
97+
///
98+
/// ```shell
99+
/// zoo alias set aabb_mm "kcl bounding-box $1 --output-unit mm"
100+
/// zoo aabb_mm my-file.kcl
101+
/// ```
102+
///
91103
#[derive(Parser, Debug, Clone)]
92104
#[clap(verbatim_doc_comment)]
93105
pub struct CmdAliasSet {
@@ -169,6 +181,10 @@ impl crate::cmd::Command for CmdAliasSet {
169181

170182
/// List your aliases.
171183
///
184+
/// ```shell
185+
/// zoo alias list
186+
/// ```
187+
///
172188
/// This command prints out all of the aliases `zoo` is configured to use.
173189
#[derive(Parser, Debug, Clone)]
174190
#[clap(verbatim_doc_comment)]

‎src/cmd_api_call.rs‎

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,13 @@ use itertools::Itertools;
44

55
/// Perform operations on CAD files.
66
///
7-
/// # convert a step file to an obj file
8-
/// $ zoo file convert ./input.step ./output.obj
7+
/// A file conversion under 25MB will not have a zoo api-call status. The requested id will return 404.
8+
///
9+
/// ```shell
10+
/// # convert a step file to an obj file
11+
/// zoo file convert ~/Downloads/cube.step ~/Downloads --output-format obj
12+
/// ```
13+
///
914
#[derive(Parser, Debug, Clone)]
1015
#[clap(verbatim_doc_comment)]
1116
pub struct CmdApiCall {
@@ -29,8 +34,10 @@ impl crate::cmd::Command for CmdApiCall {
2934

3035
/// Perform operations for API calls.
3136
///
32-
/// # get the status of an async API call
33-
/// `$ zoo api-call status <id>`
37+
/// ```shell
38+
/// # get the status of an async API call
39+
/// zoo api-call status <id>
40+
/// ```
3441
#[derive(Parser, Debug, Clone)]
3542
#[clap(verbatim_doc_comment)]
3643
pub struct CmdApiCallStatus {

‎src/cmd_app.rs‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,18 @@ an issue at https://github.com/KittyCAD/cli/issues/new"#;
1515
///
1616
/// If you do not have the app installed, you will be prompted to download it.
1717
///
18-
/// $ zoo app .
18+
/// ```shell
19+
/// zoo app .
20+
/// ```
1921
///
20-
/// $ zoo app main.kcl
22+
/// ```shell
23+
/// zoo app main.kcl
24+
/// ```
25+
///
26+
/// ```shell
27+
/// zoo app ../main.kcl
28+
/// ```
2129
///
22-
/// $ zoo app ../main.kcl
2330
#[derive(Parser, Debug, Clone)]
2431
#[clap(verbatim_doc_comment)]
2532
pub struct CmdApp {

‎src/cmd_auth.rs‎

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -84,17 +84,26 @@ pub fn parse_host(input: &str) -> Result<url::Url> {
8484
///
8585
/// Alternatively, pass in a token on standard input by using `--with-token`.
8686
///
87-
/// # start interactive setup
88-
/// $ zoo auth login
87+
/// ```shell
88+
/// # start interactive setup
89+
/// zoo auth login
90+
/// ```
8991
///
90-
/// # authenticate against a specific Zoo instance by reading the token from a file
91-
/// $ zoo --host zoo.internal auth login --with-token < mytoken.txt
92+
/// ```shell
93+
/// # authenticate against a specific Zoo instance by reading the token from a file
94+
/// zoo --host api.zoo.dev auth login --with-token < mytoken.txt
95+
/// ```
9296
///
93-
/// # authenticate with a specific Zoo instance
94-
/// $ zoo --host zoo.internal auth login
97+
/// ```shell
98+
/// # authenticate with a specific Zoo instance
99+
/// zoo --host api.zoo.dev auth login
100+
/// ```
95101
///
96-
/// # authenticate with an insecure Zoo instance (not recommended)
97-
/// $ zoo --host http://zoo.internal auth login
102+
/// ```shell
103+
/// # authenticate with an insecure Zoo instance (not recommended)
104+
/// zoo --host http://api.zoo.dev auth login
105+
/// ```
106+
///
98107
#[derive(Parser, Debug, Clone)]
99108
#[clap(verbatim_doc_comment)]
100109
pub struct CmdAuthLogin {
@@ -287,11 +296,17 @@ impl crate::cmd::Command for CmdAuthLogin {
287296
/// This command removes the authentication configuration for a host either specified
288297
/// interactively or via the global `--host` passed to `zoo`.
289298
///
290-
/// $ zoo auth logout
291-
/// # => select what host to log out of via a prompt
292299
///
293-
/// $ zoo --host zoo.internal auth logout
294-
/// # => log out of specified host
300+
/// ```shell
301+
/// zoo auth logout
302+
/// # => select what host to log out of via a prompt
303+
/// ```
304+
///
305+
/// ```shell
306+
/// zoo --host api.zoo.dev auth logout
307+
/// # => log out of specified host
308+
/// ```
309+
///
295310
#[derive(Parser, Debug, Clone)]
296311
#[clap(verbatim_doc_comment)]
297312
pub struct CmdAuthLogout {}

‎src/cmd_completion.rs‎

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,36 +18,49 @@ use clap_complete::{Shell, generate};
1818
///
1919
/// After, add this to your `~/.bash_profile`:
2020
///
21-
/// eval "$(zoo completion -s bash)"
22-
///
21+
/// ```shell
22+
/// eval "$(zoo completion -s bash)"
23+
/// ```
24+
///
2325
/// ### zsh
2426
/// Generate a `_zoo` completion script and put it somewhere in your `$fpath`:
2527
///
26-
/// zoo completion -s zsh > /usr/local/share/zsh/site-functions/_zoo
27-
///
28+
/// ```shell
29+
/// zoo completion -s zsh > /usr/local/share/zsh/site-functions/_zoo
30+
/// ```
31+
///
2832
/// Ensure that the following is present in your `~/.zshrc`:
2933
///
30-
/// autoload -U compinit
31-
/// compinit -i
34+
/// ```
35+
/// autoload -U compinit
36+
/// compinit -i
37+
/// ```
3238
///
3339
/// Zsh version 5.7 or later is recommended.
3440
///
3541
/// ### fish
3642
///
3743
/// Generate a `zoo.fish` completion script:
3844
///
39-
/// zoo completion -s fish > ~/.config/fish/completions/zoo.fish
40-
///
45+
/// ```shell
46+
/// zoo completion -s fish > ~/.config/fish/completions/zoo.fish
47+
/// ```
48+
///
4149
/// ### PowerShell
4250
///
4351
/// Open your profile script with:
4452
///
45-
/// mkdir -Path (Split-Path -Parent $profile) -ErrorAction SilentlyContinue
46-
/// notepad $profile
53+
/// ```shell
54+
/// mkdir -Path (Split-Path -Parent $profile) -ErrorAction SilentlyContinue
55+
/// notepad $profile
56+
/// ```
4757
///
4858
/// Add the line and save the file:
4959
///
50-
/// Invoke-Expression -Command $(zoo completion -s powershell | Out-String)
60+
/// ```shell
61+
/// Invoke-Expression -Command $(zoo completion -s powershell | Out-String)
62+
/// ```
63+
///
5164
#[derive(Parser, Debug, Clone)]
5265
#[clap(verbatim_doc_comment)]
5366
pub struct CmdCompletion {

‎src/cmd_file.rs‎

Lines changed: 75 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,11 @@ use crate::cmd_kcl::write_deterministic_export;
1515

1616
/// Perform operations on CAD files.
1717
///
18-
/// # convert a step file to an obj file
19-
/// $ zoo file convert --output-format=obj ./input.step ./
18+
/// ```shell
19+
/// # convert a step file to an obj file
20+
/// zoo file convert --output-format=obj ./input.step ./
21+
/// ```
22+
///
2023
#[derive(Parser, Debug, Clone)]
2124
#[clap(verbatim_doc_comment)]
2225
pub struct CmdFile {
@@ -54,17 +57,25 @@ impl crate::cmd::Command for CmdFile {
5457
///
5558
/// If the file being converted is larger than a certain size it will be
5659
/// performed asynchronously, you can then check its status with the
57-
/// `zoo api-call status <id_of_your_operation>` command.
60+
/// `zoo api-call status <id_of_your_operation>` command. The status call will return
61+
/// 404 if the size is under 25MB, it will not be processed asynchronously.
5862
///
59-
/// # convert step to obj
60-
/// $ zoo file convert --output-format=obj my-file.step output_dir
63+
/// ```shell
64+
/// # convert step to obj
65+
/// zoo file convert --output-format=obj my-file.step output_dir
66+
/// ```
6167
///
62-
/// # convert obj to step
63-
/// $ zoo file convert --output-format=step my-obj.obj .
68+
/// ```shell
69+
/// # convert obj to step
70+
/// zoo file convert --output-format=step my-obj.obj .
71+
/// ```
72+
///
73+
/// ```shell
74+
/// # pass a file to convert from stdin
75+
/// # when converting from stdin, the original file type is required
76+
/// cat my-obj.obj | zoo file convert --output-format=step --src-format=obj - output_dir
77+
/// ```
6478
///
65-
/// # pass a file to convert from stdin
66-
/// # when converting from stdin, the original file type is required
67-
/// $ cat my-obj.obj | zoo file convert --output-format=step - output_dir
6879
#[derive(Parser, Debug, Clone)]
6980
#[clap(verbatim_doc_comment)]
7081
pub struct CmdFileConvert {
@@ -163,11 +174,16 @@ impl crate::cmd::Command for CmdFileConvert {
163174

164175
/// Snapshot a render of a CAD file as any supported image format.
165176
///
166-
/// # snapshot as png
167-
/// $ zoo file snapshot my-file.obj my-file.png
177+
/// ```shell
178+
/// # snapshot as png
179+
/// zoo file snapshot my-file.obj my-file.png
180+
/// ```
181+
///
182+
/// ```shell
183+
/// # pass a file to snapshot from stdin
184+
/// cat my-obj.obj | zoo file snapshot --output-format=png --src-format=obj - my-file.png
185+
/// ```
168186
///
169-
/// # pass a file to snapshot from stdin
170-
/// $ cat my-obj.obj | zoo file snapshot --output-format=png - my-file.png
171187
#[derive(Parser, Debug, Clone)]
172188
#[clap(verbatim_doc_comment)]
173189
pub struct CmdFileSnapshot {
@@ -370,11 +386,16 @@ impl crate::cmd::Command for CmdFileSnapshot {
370386
/// performed asynchronously, you can then check the status with the
371387
/// `zoo api-call status <id_of_your_operation>` command.
372388
///
373-
/// # get the volume of a file
374-
/// $ zoo file volume my-file.step
389+
/// ```shell
390+
/// # get the volume of a file
391+
/// zoo file volume my-file.step --output-unit=mm3
392+
/// ```
375393
///
376-
/// # pass a file from stdin, the original file type is required
377-
/// $ cat my-obj.obj | zoo file volume - --src-format=obj
394+
/// ```shell
395+
/// # pass a file from stdin, the original file type is required
396+
/// cat my-obj.obj | zoo file volume - --src-format=obj --output-unit=mm3
397+
/// ```
398+
///
378399
#[derive(Parser, Debug, Clone)]
379400
#[clap(verbatim_doc_comment)]
380401
pub struct CmdFileVolume {
@@ -431,11 +452,16 @@ impl crate::cmd::Command for CmdFileVolume {
431452
/// performed asynchronously, you can then check the status with the
432453
/// `zoo api-call status <id_of_your_operation>` command.
433454
///
434-
/// # get the mass of a file
435-
/// $ zoo file mass my-file.step
455+
/// ```shell
456+
/// # get the mass of a file
457+
/// zoo file mass my-file.step --material-density 500 --material-density-unit=kg-m3 --output-unit=kg
458+
/// ```
436459
///
437-
/// # pass a file from stdin, the original file type is required
438-
/// $ cat my-obj.obj | zoo file mass - --src-format=obj
460+
/// ```shell
461+
/// # pass a file from stdin, the original file type is required
462+
/// cat my-obj.obj | zoo file mass - --src-format=obj --material-density 500 --material-density-unit=kg-m3 --output-unit=kg
463+
/// ```
464+
///
439465
#[derive(Parser, Debug, Clone)]
440466
#[clap(verbatim_doc_comment)]
441467
pub struct CmdFileMass {
@@ -510,11 +536,16 @@ impl crate::cmd::Command for CmdFileMass {
510536
/// performed asynchronously, you can then check the status with the
511537
/// `zoo api-call status <id_of_your_operation>` command.
512538
///
513-
/// # get the mass of a file
514-
/// $ zoo file center-of-mass my-file.step
539+
/// ```shell
540+
/// # get the mass of a file
541+
/// zoo file center-of-mass my-file.step --output-unit=m
542+
/// ```
515543
///
516-
/// # pass a file from stdin, the original file type is required
517-
/// $ cat my-obj.obj | zoo file center-of-mass - --src-format=obj
544+
/// ```shell
545+
/// # pass a file from stdin, the original file type is required
546+
/// cat my-obj.obj | zoo file center-of-mass - --src-format=obj --output-unit=m
547+
/// ```
548+
///
518549
#[derive(Parser, Debug, Clone)]
519550
#[clap(verbatim_doc_comment)]
520551
pub struct CmdFileCenterOfMass {
@@ -571,11 +602,16 @@ impl crate::cmd::Command for CmdFileCenterOfMass {
571602
/// performed asynchronously, you can then check the status with the
572603
/// `zoo api-call status <id_of_your_operation>` command.
573604
///
574-
/// # get the density of a file
575-
/// $ zoo file density my-file.step
605+
/// ```shell
606+
/// # get the density of a file
607+
/// zoo file density my-file.step --material-mass 212.2923 --material-mass-unit g --output-unit kg-m3
608+
/// ```
609+
///
610+
/// ```shell
611+
/// # pass a file from stdin, the original file type is required
612+
/// cat my-obj.obj | zoo file density - --src-format=obj -material-mass 212.2923 --material-mass-unit g --output-unit kg-m3
613+
/// ```
576614
///
577-
/// # pass a file from stdin, the original file type is required
578-
/// $ cat my-obj.obj | zoo file density - --src-format=obj
579615
#[derive(Parser, Debug, Clone)]
580616
#[clap(verbatim_doc_comment)]
581617
pub struct CmdFileDensity {
@@ -650,11 +686,16 @@ impl crate::cmd::Command for CmdFileDensity {
650686
/// performed asynchronously, you can then check the status with the
651687
/// `zoo api-call status <id_of_your_operation>` command.
652688
///
653-
/// # get the surface-area of a file
654-
/// $ zoo file surface-area my-file.step
689+
/// ```shell
690+
/// # get the surface-area of a file
691+
/// zoo file surface-area my-file.step --output-unit m2
692+
/// ```
693+
///
694+
/// ```shell
695+
/// # pass a file from stdin, the original file type is required
696+
/// cat my-obj.obj | zoo file surface-area - --src-format=obj --output-unit m2
697+
/// ```
655698
///
656-
/// # pass a file from stdin, the original file type is required
657-
/// $ cat my-obj.obj | zoo file surface-area - --src-format=obj
658699
#[derive(Parser, Debug, Clone)]
659700
#[clap(verbatim_doc_comment)]
660701
pub struct CmdFileSurfaceArea {

0 commit comments

Comments
 (0)