1
Fork 0
mirror of https://github.com/RGBCube/nu_scripts synced 2025-08-01 22:57:46 +00:00

Move completions to module format (#195)

* Move custom completions to module format

* Describe usage in README of custom completions
This commit is contained in:
Hofer-Julian 2022-03-31 13:30:07 +02:00 committed by GitHub
parent f394c2819e
commit ef5de3ed96
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 54 additions and 29 deletions

View file

@ -1,5 +1,10 @@
# Cargo Custom Completions # Cargo Custom Completions
### Definition This script provides custom completions for cargo.
It can be used by importing its exported commands via:
These scripts should be used to demonstrate how create custom completions for cargo. ```
use path/to/cargo/cargo-completions.nu *
```
With `path/to` being either the relative path of the file to your current working directory or its absolute path.

View file

@ -23,7 +23,7 @@ def "nu-complete cargo features" [] {
open Cargo.toml | get features | transpose | get column0 open Cargo.toml | get features | transpose | get column0
} }
extern "cargo run" [ export extern "cargo run" [
...args: any # arguments ...args: any # arguments
--bin: string@"nu-complete cargo bins" # Name of the bin target to run --bin: string@"nu-complete cargo bins" # Name of the bin target to run
--example: string@"nu-complete cargo examples" # Name of the example target to run --example: string@"nu-complete cargo examples" # Name of the example target to run

View file

@ -1,5 +1,10 @@
# Git Custom Completions # Git Custom Completions
### Definition This script provides custom completions for git.
It can be used by importing its exported commands via:
These scripts should be used to demonstrate how create custom completions for git. ```
use path/to/git/git-completions.nu *
```
With `path/to` being either the relative path of the file to your current working directory or its absolute path.

View file

@ -1,5 +1,10 @@
# Make Custom Completions # Make Custom Completions
### Definition This script provides custom completions for make.
It can be used by importing its exported commands via:
These scripts should be used to demonstrate how create custom completions for make. ```
use path/to/make/make-completions.nu *
```
With `path/to` being either the relative path of the file to your current working directory or its absolute path.

View file

@ -14,7 +14,7 @@ def "nu-complete make" [] {
ls **/*|where type == dir|get name ls **/*|where type == dir|get name
} }
extern "make" [ export extern "make" [
command: string@"nu-complete make" command: string@"nu-complete make"
--always-make(-B) # Unconditionally make all targets. --always-make(-B) # Unconditionally make all targets.
--directory(-C): string@"nu-complete make dirs" # Change to DIRECTORY before doing anything. --directory(-C): string@"nu-complete make dirs" # Change to DIRECTORY before doing anything.
@ -53,4 +53,4 @@ def "nu-complete make" [] {
--new-file: string@"nu-complete files" --new-file: string@"nu-complete files"
--assume-new: string@"nu-complete files" --assume-new: string@"nu-complete files"
--warn-undefined-variables # Warn when an undefined variable is referenced. --warn-undefined-variables # Warn when an undefined variable is referenced.
] ]

View file

@ -1,5 +1,10 @@
# NPM Custom Completions # NPM Custom Completions
### Definition This script provides custom completions for npm.
It can be used by importing its exported commands via:
These scripts should be used to demonstrate how create custom completions for npm. ```
use path/to/npm/npm-completions.nu *
```
With `path/to` being either the relative path of the file to your current working directory or its absolute path.

View file

@ -1,5 +1,10 @@
# Winget Custom Completions # Winget Custom Completions
### Definition This script provides custom completions for winget.
It can be used by importing its exported commands via:
These scripts should be used to demonstrate how create custom completions for winget. ```
use path/to/winget/winget-completions.nu *
```
With `path/to` being either the relative path of the file to your current working directory or its absolute path.

View file

@ -1,14 +1,14 @@
# Written by Genna # Written by Genna
# Windows Package Manager # Windows Package Manager
extern winget [ export extern winget [
--version(-v): bool, # Display the version of the tool --version(-v): bool, # Display the version of the tool
--info: bool, # Display general info of the tool --info: bool, # Display general info of the tool
--help(-?): bool, # Display the help for this command --help(-?): bool, # Display the help for this command
] ]
# Installs the given package # Installs the given package
extern "winget install" [ export extern "winget install" [
query?: string@"nu-complete winget install name", query?: string@"nu-complete winget install name",
--query(-q): string@"nu-complete winget install name", # The query used to search for a package --query(-q): string@"nu-complete winget install name", # The query used to search for a package
--manifest(-m): path, # The path to the manifest of the package --manifest(-m): path, # The path to the manifest of the package
@ -99,12 +99,12 @@ def "winget show" [
} }
# Manage sources of packages # Manage sources of packages
extern "winget source" [ export extern "winget source" [
--help(-?): bool # Display the help for this command --help(-?): bool # Display the help for this command
] ]
# Add a new source # Add a new source
extern "winget source add" [ export extern "winget source add" [
--name(-n): string, # Name of the source --name(-n): string, # Name of the source
--arg(-a): string, # Argument given to the source --arg(-a): string, # Argument given to the source
--type(-t): string@"nu-complete winget source type", # Type of the source --type(-t): string@"nu-complete winget source type", # Type of the source
@ -142,26 +142,26 @@ def "winget source list" [
} }
# Update current sources # Update current sources
extern "winget source update" [ export extern "winget source update" [
--name(-n): string, # Name of the source --name(-n): string, # Name of the source
--help(-?): bool # Display the help for this command --help(-?): bool # Display the help for this command
] ]
# Remove current sources # Remove current sources
extern "winget source remove" [ export extern "winget source remove" [
--name(-n): string, # Name of the source --name(-n): string, # Name of the source
--help(-?): bool # Display the help for this command --help(-?): bool # Display the help for this command
] ]
# Reset sources # Reset sources
extern "winget source reset" [ export extern "winget source reset" [
--name(-n): string, # Name of the source --name(-n): string, # Name of the source
--force: bool, # Forces the reset of the sources --force: bool, # Forces the reset of the sources
--help(-?): bool # Display the help for this command --help(-?): bool # Display the help for this command
] ]
# Export current sources # Export current sources
extern "winget source export" [ export extern "winget source export" [
--name(-n): string, # Name of the source --name(-n): string, # Name of the source
--help(-?): bool # Display the help for this command --help(-?): bool # Display the help for this command
] ]
@ -263,7 +263,7 @@ def "winget list" [
} }
# Upgrades the given package # Upgrades the given package
extern "winget upgrade" [ export extern "winget upgrade" [
query?: string, query?: string,
--query(-q): string, # The query used to search for a package --query(-q): string, # The query used to search for a package
--manifest(-m): path, # The path to the manifest of the package --manifest(-m): path, # The path to the manifest of the package
@ -287,7 +287,7 @@ extern "winget upgrade" [
] ]
# Uninstalls the given package # Uninstalls the given package
extern "winget uninstall" [ export extern "winget uninstall" [
query?: string@"nu-complete winget uninstall package name", query?: string@"nu-complete winget uninstall package name",
--query(-q): string@"nu-complete winget uninstall package name", # The query used to search for a package --query(-q): string@"nu-complete winget uninstall package name", # The query used to search for a package
--manifest(-m): path, # The path to the manifest of the package --manifest(-m): path, # The path to the manifest of the package
@ -304,7 +304,7 @@ extern "winget uninstall" [
] ]
# Helper to hash installer files # Helper to hash installer files
extern "winget hash" [ export extern "winget hash" [
file?: path, # File to be hashed file?: path, # File to be hashed
--file(-f): path, # File to be hashed --file(-f): path, # File to be hashed
--msix(-m): bool, # Input file will be treated as msix; signature hash will be provided if signed --msix(-m): bool, # Input file will be treated as msix; signature hash will be provided if signed
@ -312,26 +312,26 @@ extern "winget hash" [
] ]
# Validates a manifest file # Validates a manifest file
extern "winget validate" [ export extern "winget validate" [
manifest?: path, # The path to the manifest to be validated manifest?: path, # The path to the manifest to be validated
--manifest: path, # The path to the manifest to be validated --manifest: path, # The path to the manifest to be validated
--help(-?): bool # Display the help for this command --help(-?): bool # Display the help for this command
] ]
# Open settings or set administrator settings # Open settings or set administrator settings
extern "winget settings" [ export extern "winget settings" [
--enable: string, # Enables the specific administrator setting --enable: string, # Enables the specific administrator setting
--disable: string, # Disables the specific administrator setting --disable: string, # Disables the specific administrator setting
--help(-?): bool # Display the help for this command --help(-?): bool # Display the help for this command
] ]
# Shows the status of experimental features # Shows the status of experimental features
extern "winget features" [ export extern "winget features" [
--help(-?): bool # Display the help for this command --help(-?): bool # Display the help for this command
] ]
# Exports a list of the installed packages # Exports a list of the installed packages
extern "winget export" [ export extern "winget export" [
output?: path, # File where the result is to be written output?: path, # File where the result is to be written
--output(-o): path, # File where the result is to be written --output(-o): path, # File where the result is to be written
--source(-s): string@"nu-complete winget install source", # Export packages from the specified source --source(-s): string@"nu-complete winget install source", # Export packages from the specified source
@ -340,7 +340,7 @@ extern "winget export" [
--help(-?): bool # Display the help for this command --help(-?): bool # Display the help for this command
] ]
extern "winget import" [ export extern "winget import" [
import-file?: path, # File describing the packages to install import-file?: path, # File describing the packages to install
--import-file(-i): path, # File describing the packages to install --import-file(-i): path, # File describing the packages to install
--ignore-unavailable: bool, # Ignore unavailable packages --ignore-unavailable: bool, # Ignore unavailable packages