Skip to content

Commit

Permalink
feat(nu): allow the generated completion scripts to be used with `use…
Browse files Browse the repository at this point in the history
…` and `overlay use`

The generated scripts can be used as script, module and overlay.

* script
  `source completion_script.nu`

* module
  `use completion_script.nu *`

* overlay
  `overlay use completion_script.nu`
  • Loading branch information
nibon7 committed Sep 11, 2023
1 parent 6eac611 commit e78f3fd
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion clap_complete_nushell/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ impl Generator for Nushell {
}

completions.push_str("}\n\n");
completions.push_str("use completions *\n");
completions.push_str("export use completions *\n");

buf.write_all(completions.as_bytes())
.expect("Failed to write to generated file")
Expand Down
2 changes: 1 addition & 1 deletion clap_complete_nushell/tests/snapshots/aliases.nu
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ module completions {

}

use completions *
export use completions *
2 changes: 1 addition & 1 deletion clap_complete_nushell/tests/snapshots/basic.nu
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ module completions {

}

use completions *
export use completions *
2 changes: 1 addition & 1 deletion clap_complete_nushell/tests/snapshots/feature_sample.nu
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ module completions {

}

use completions *
export use completions *
Original file line number Diff line number Diff line change
Expand Up @@ -255,4 +255,4 @@ module completions {

}

use completions *
export use completions *
2 changes: 1 addition & 1 deletion clap_complete_nushell/tests/snapshots/quoting.nu
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,4 @@ module completions {

}

use completions *
export use completions *
2 changes: 1 addition & 1 deletion clap_complete_nushell/tests/snapshots/special_commands.nu
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,4 @@ module completions {

}

use completions *
export use completions *
2 changes: 1 addition & 1 deletion clap_complete_nushell/tests/snapshots/sub_subcommands.nu
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,4 @@ module completions {

}

use completions *
export use completions *
2 changes: 1 addition & 1 deletion clap_complete_nushell/tests/snapshots/value_hint.nu
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ module completions {

}

use completions *
export use completions *

0 comments on commit e78f3fd

Please sign in to comment.