Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ add gh gist and gh repo list and view #794

Merged
merged 1 commit into from
Mar 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
✨ add gh gist and gh repo list and view
  • Loading branch information
AucaCoyan committed Mar 17, 2024
commit 0fdd5abfdc6f3a9fb6997637de548bd2b6808d08
88 changes: 88 additions & 0 deletions custom-completions/gh/gh-completions.nu
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,64 @@ export extern "gh gist" [
--help # Show help for command
]

export extern "gh gist clone" [
gist: string # gist to clone
directory?:path # directory to clone
--help # Show help for command
]

export extern "gh gist create" [
filename_or_stdin: string # gist to create
--desc(-d): string # A description for this gist
--filename(-f): string # Provide a filename to be used when reading from standard input
--public(-p) # List the gist publicly (default: secret)
--web(-w) # Open the web browser with created gist
--public # Make the new gist public
--help # Show help for command
]

export extern "gh gist delete" [
gist: string@"nu-complete gist list" # gist to delete
--help # Show help for command
]

export extern "gh gist edit" [
gist: string@"nu-complete gist list" # gist to edit
--add(-a): string # Add a new file to the gist
--desc(-d): string # New description for the gist
--filename(-f): string # Select a file to edit
--remove(-r): string # Remove a file from the gist
--help # Show help for command
]

def "nu-complete gist list" [] {
# TODO add the name of the gist to autocompletion
^gh gist list --limit 100 | lines | str replace --regex --multiline '\S+\K.*' ''
}

export extern "gh gist list" [
--limit(-L): number # Maximum number of repositories to list (default 30)
--public # Show only the public gists
--secret # Show only the secret gists
--help # Show help for command
]

export extern "gh gist rename" [
gist: string # gist to rename
oldFilename: string # gist to rename
newFilename: string # gist to rename
--help # Show help for command
]

export extern "gh gist view" [
gist?: string # gist to view
--filename(-f): string # Display a single file from the gist
--files # List file names from the gist
--raw(-r) # Print raw instead of rendered gist contents
--web(-w) # Open gist in the browser
--help # Show help for command
]

def "nu-complete gh issue" [] {
^gh issue --help
| lines
Expand Down Expand Up @@ -175,6 +233,36 @@ export extern "gh repo clone" [
--help # Show help for command
]

def "nu-complete visibility" [] {
['public', 'private', 'internal']
}

export extern "gh repo list" [
owner?: string # List repos of this owner
--archived # Show only archived repositories
--fork # Show only forks
--jq(-q):string # Filter JSON output using a jq expression
--json: string # Output JSON with the specified fields
--language(-l): string # Filter by primary coding language
--limit(-L): number # Maximum number of repositories to list (default 30)
--no-archived # Omit archived repositories
--source # Show only non-forks
--template(-t): string # Format JSON output using a Go template; see "gh help formatting"
--topic: string # Filter by topic
--visibility: string@"nu-complete visibility" # Filter by repository visibility: {public|private|internal}
--help # Show help for command
]

export extern "gh repo view" [
org_repo: string # <ORG/REPO> to view
--branch(-b):string # View a specific branch of the repository
--jq(-q):string # Filter JSON output using a jq expression
--json: string # Output JSON with the specified fields
--template(-t):string # Format JSON output using a Go template; see "gh help formatting"
--web # Open a repository in the browser
--help # Show help for command
]

def "nu-complete gitignore list" [] {
^gh api -H "Accept: application/vnd.github+json" /gitignore/templates
| from json
Expand Down