Skip to content

Commit

Permalink
work on sugar commands (#194)
Browse files Browse the repository at this point in the history
## changelog
- commands renamed
- top-level commands added for command name completion and help
- argument completion
- new `gm repo remote add` command
  • Loading branch information
amtoine authored Apr 20, 2024
1 parent eaf9f5b commit a8dfb12
Show file tree
Hide file tree
Showing 30 changed files with 236 additions and 75 deletions.
10 changes: 8 additions & 2 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,26 @@
- [`gm cfg`](nu-git-manager-sugar/dotfiles/gm-cfg.md)
- [`gm cfg edit`](nu-git-manager-sugar/dotfiles/gm-cfg-edit.md)
- [`gm report`](nu-git-manager-sugar/extra/gm-report.md)
- [`gm repo`](nu-git-manager-sugar/git/gm-repo.md)
- [`gm repo bisect`](nu-git-manager-sugar/git/gm-repo-bisect.md)
- [`gm repo branch`](nu-git-manager-sugar/git/gm-repo-branch.md)
- [`gm repo branch clean`](nu-git-manager-sugar/git/gm-repo-branch-clean.md)
- [`gm repo branch fetch`](nu-git-manager-sugar/git/gm-repo-branch-fetch.md)
- [`gm repo branch interactive-delete`](nu-git-manager-sugar/git/gm-repo-branch-interactive-delete.md)
- [`gm repo branch list`](nu-git-manager-sugar/git/gm-repo-branch-list.md)
- [`gm repo branch wipe`](nu-git-manager-sugar/git/gm-repo-branch-wipe.md)
- [`gm repo branches`](nu-git-manager-sugar/git/gm-repo-branches.md)
- [`gm repo compare`](nu-git-manager-sugar/git/gm-repo-compare.md)
- [`gm repo fetch branch`](nu-git-manager-sugar/git/gm-repo-fetch-branch.md)
- [`gm repo get commit`](nu-git-manager-sugar/git/gm-repo-get-commit.md)
- [`gm repo goto root`](nu-git-manager-sugar/git/gm-repo-goto-root.md)
- [`gm repo is-ancestor`](nu-git-manager-sugar/git/gm-repo-is-ancestor.md)
- [`gm repo ls`](nu-git-manager-sugar/git/gm-repo-ls.md)
- [`gm repo query`](nu-git-manager-sugar/git/gm-repo-query.md)
- [`gm repo remote`](nu-git-manager-sugar/git/gm-repo-remote.md)
- [`gm repo remote add`](nu-git-manager-sugar/git/gm-repo-remote-add.md)
- [`gm repo remote list`](nu-git-manager-sugar/git/gm-repo-remote-list.md)
- [`gm repo switch`](nu-git-manager-sugar/git/gm-repo-switch.md)
- [`setup`](nu-git-manager-sugar/git/prompt/setup.md)
- [`gm gh`](nu-git-manager-sugar/github/gm-gh.md)
- [`gm gh pr checkout`](nu-git-manager-sugar/github/gm-gh-pr-checkout.md)
- [`gm gh query-api`](nu-git-manager-sugar/github/gm-gh-query-api.md)
- [`gm gh query-releases`](nu-git-manager-sugar/github/gm-gh-query-releases.md)
Expand Down
2 changes: 1 addition & 1 deletion docs/nu-git-manager-sugar/git/gm-repo-bisect.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# `gm repo bisect` from `nu-git-manager-sugar git` (see [source](https://github.com/amtoine/nu-git-manager/blob/main/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/mod.nu#L384))
# `gm repo bisect` from `nu-git-manager-sugar git` (see [source](https://github.com/amtoine/nu-git-manager/blob/main/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/mod.nu#L435))
bisect a worktree by running a piece of code repeatedly

# Examples
Expand Down
20 changes: 20 additions & 0 deletions docs/nu-git-manager-sugar/git/gm-repo-branch-clean.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# `gm repo branch clean` from `nu-git-manager-sugar git` (see [source](https://github.com/amtoine/nu-git-manager/blob/main/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/mod.nu#L105))
clean local dangling branches

> **Note**
> in the following, a "*dangling*" branch refers to a branch that does not have any remote
> counterpart, i.e. it's a purely local branch.
## Examples
```nushell
# clean all dangling branches
gm repo branch clean
```

## Parameters


## Signatures
| input | output |
| --------- | --------- |
| `nothing` | `nothing` |
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# `gm repo fetch branch` from `nu-git-manager-sugar git` (see [source](https://github.com/amtoine/nu-git-manager/blob/main/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/mod.nu#L178))
# `gm repo branch fetch` from `nu-git-manager-sugar git` (see [source](https://github.com/amtoine/nu-git-manager/blob/main/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/mod.nu#L229))
fetch a remote branch locally, without pulling down the whole remote


Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# `gm repo branch interactive-delete` from `nu-git-manager-sugar git` (see [source](https://github.com/amtoine/nu-git-manager/blob/main/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/mod.nu#L230))
# `gm repo branch interactive-delete` from `nu-git-manager-sugar git` (see [source](https://github.com/amtoine/nu-git-manager/blob/main/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/mod.nu#L281))
remove a branch interactively


Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# `gm repo branches` from `nu-git-manager-sugar git` (see [source](https://github.com/amtoine/nu-git-manager/blob/main/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/mod.nu#L76))
inspect local branches
# `gm repo branch list` from `nu-git-manager-sugar git` (see [source](https://github.com/amtoine/nu-git-manager/blob/main/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/mod.nu#L75))
list local branches

> **Note**
> in the following, a "*dangling*" branch refers to a branch that does not have any remote
Expand All @@ -8,16 +8,10 @@ inspect local branches
## Examples
```nushell
# list branches and their associated remotes
gm repo branches
```
---
```nushell
# clean all dangling branches
gm repo branches --clean
gm repo branch list
```

## Parameters
- `--clean` <`bool`>: clean all dangling branches


## Signatures
Expand Down
6 changes: 3 additions & 3 deletions docs/nu-git-manager-sugar/git/gm-repo-branch-wipe.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# `gm repo branch wipe` from `nu-git-manager-sugar git` (see [source](https://github.com/amtoine/nu-git-manager/blob/main/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/mod.nu#L117))
# `gm repo branch wipe` from `nu-git-manager-sugar git` (see [source](https://github.com/amtoine/nu-git-manager/blob/main/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/mod.nu#L125))
wipe a branch completely, i.e. both locally and remotely



## Parameters
- `branch` <`string`>: the branch to wipe
- `remote` <`string`>: the remote to push to
- `branch` <`string@get-branches`>: the branch to wipe
- `remote` <`string@get-remotes`>: the remote to push to


## Signatures
Expand Down
12 changes: 12 additions & 0 deletions docs/nu-git-manager-sugar/git/gm-repo-branch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# `gm repo branch` from `nu-git-manager-sugar git` (see [source](https://github.com/amtoine/nu-git-manager/blob/main/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/mod.nu#L62))




## Parameters


## Signatures
| input | output |
| ----- | ------ |
| `any` | `any` |
2 changes: 1 addition & 1 deletion docs/nu-git-manager-sugar/git/gm-repo-compare.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# `gm repo compare` from `nu-git-manager-sugar git` (see [source](https://github.com/amtoine/nu-git-manager/blob/main/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/mod.nu#L35))
# `gm repo compare` from `nu-git-manager-sugar git` (see [source](https://github.com/amtoine/nu-git-manager/blob/main/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/mod.nu#L37))
compare the changes between two revisions, from a target to the "head"


Expand Down
2 changes: 1 addition & 1 deletion docs/nu-git-manager-sugar/git/gm-repo-get-commit.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# `gm repo get commit` from `nu-git-manager-sugar git` (see [source](https://github.com/amtoine/nu-git-manager/blob/main/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/mod.nu#L28))
# `gm repo get commit` from `nu-git-manager-sugar git` (see [source](https://github.com/amtoine/nu-git-manager/blob/main/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/mod.nu#L30))
get the commit hash of any revision

## Examples
Expand Down
2 changes: 1 addition & 1 deletion docs/nu-git-manager-sugar/git/gm-repo-goto-root.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# `gm repo goto root` from `nu-git-manager-sugar git` (see [source](https://github.com/amtoine/nu-git-manager/blob/main/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/mod.nu#L56))
# `gm repo goto root` from `nu-git-manager-sugar git` (see [source](https://github.com/amtoine/nu-git-manager/blob/main/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/mod.nu#L58))
go to the root of the repository from anywhere in the worktree

## Examples
Expand Down
2 changes: 1 addition & 1 deletion docs/nu-git-manager-sugar/git/gm-repo-is-ancestor.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# `gm repo is-ancestor` from `nu-git-manager-sugar git` (see [source](https://github.com/amtoine/nu-git-manager/blob/main/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/mod.nu#L144))
# `gm repo is-ancestor` from `nu-git-manager-sugar git` (see [source](https://github.com/amtoine/nu-git-manager/blob/main/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/mod.nu#L152))
return true iif the first revision is an ancestor of the second

## Examples
Expand Down
2 changes: 1 addition & 1 deletion docs/nu-git-manager-sugar/git/gm-repo-ls.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# `gm repo ls` from `nu-git-manager-sugar git` (see [source](https://github.com/amtoine/nu-git-manager/blob/main/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/mod.nu#L274))
# `gm repo ls` from `nu-git-manager-sugar git` (see [source](https://github.com/amtoine/nu-git-manager/blob/main/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/mod.nu#L325))
get some information about a repo


Expand Down
2 changes: 1 addition & 1 deletion docs/nu-git-manager-sugar/git/gm-repo-query.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# `gm repo query` from `nu-git-manager-sugar git` (see [source](https://github.com/amtoine/nu-git-manager/blob/main/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/mod.nu#L324))
# `gm repo query` from `nu-git-manager-sugar git` (see [source](https://github.com/amtoine/nu-git-manager/blob/main/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/mod.nu#L375))
queries the `.git/` directory as a database with `nu_plugin_git_query`

## Examples
Expand Down
27 changes: 27 additions & 0 deletions docs/nu-git-manager-sugar/git/gm-repo-remote-add.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# `gm repo remote add` from `nu-git-manager-sugar git` (see [source](https://github.com/amtoine/nu-git-manager/blob/main/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/mod.nu#L202))
add a remote to the current repository

> **Note**
> will throw an error if `$remote` does not appear to be a valid URL.
## Examples
```nushell
# add `https://www.example.com` to the remotes as `upstream`
gm repo remote add upstream https://www.example.com
```
---
```nushell
# add `https://www.example.com` to the remotes as `upstream`, using the SSH protocol
gm repo remote add upstream https://www.example.com --ssh
```

## Parameters
- `name` <`string`>:
- `remote` <`string`>:
- `--ssh` <`bool`>:


## Signatures
| input | output |
| --------- | --------- |
| `nothing` | `nothing` |
2 changes: 1 addition & 1 deletion docs/nu-git-manager-sugar/git/gm-repo-remote-list.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# `gm repo remote list` from `nu-git-manager-sugar git` (see [source](https://github.com/amtoine/nu-git-manager/blob/main/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/mod.nu#L163))
# `gm repo remote list` from `nu-git-manager-sugar git` (see [source](https://github.com/amtoine/nu-git-manager/blob/main/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/mod.nu#L173))
get the list of all the remotes in the current repository

## Examples
Expand Down
12 changes: 12 additions & 0 deletions docs/nu-git-manager-sugar/git/gm-repo-remote.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# `gm repo remote` from `nu-git-manager-sugar git` (see [source](https://github.com/amtoine/nu-git-manager/blob/main/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/mod.nu#L159))




## Parameters


## Signatures
| input | output |
| ----- | ------ |
| `any` | `any` |
2 changes: 1 addition & 1 deletion docs/nu-git-manager-sugar/git/gm-repo-switch.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# `gm repo switch` from `nu-git-manager-sugar git` (see [source](https://github.com/amtoine/nu-git-manager/blob/main/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/mod.nu#L250))
# `gm repo switch` from `nu-git-manager-sugar git` (see [source](https://github.com/amtoine/nu-git-manager/blob/main/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/mod.nu#L301))
switch between branches interactively


Expand Down
12 changes: 12 additions & 0 deletions docs/nu-git-manager-sugar/git/gm-repo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# `gm repo` from `nu-git-manager-sugar git` (see [source](https://github.com/amtoine/nu-git-manager/blob/main/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/mod.nu#L16))




## Parameters


## Signatures
| input | output |
| ----- | ------ |
| `any` | `any` |
9 changes: 7 additions & 2 deletions docs/nu-git-manager-sugar/git/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,22 @@ ships a bunch of helper commands that augments the capabilities of Git.
/!\ this module is part of the optional NGM. /!\

## Commands
- [`gm repo`](gm-repo.md)
- [`gm repo bisect`](gm-repo-bisect.md)
- [`gm repo branch`](gm-repo-branch.md)
- [`gm repo branch clean`](gm-repo-branch-clean.md)
- [`gm repo branch fetch`](gm-repo-branch-fetch.md)
- [`gm repo branch interactive-delete`](gm-repo-branch-interactive-delete.md)
- [`gm repo branch list`](gm-repo-branch-list.md)
- [`gm repo branch wipe`](gm-repo-branch-wipe.md)
- [`gm repo branches`](gm-repo-branches.md)
- [`gm repo compare`](gm-repo-compare.md)
- [`gm repo fetch branch`](gm-repo-fetch-branch.md)
- [`gm repo get commit`](gm-repo-get-commit.md)
- [`gm repo goto root`](gm-repo-goto-root.md)
- [`gm repo is-ancestor`](gm-repo-is-ancestor.md)
- [`gm repo ls`](gm-repo-ls.md)
- [`gm repo query`](gm-repo-query.md)
- [`gm repo remote`](gm-repo-remote.md)
- [`gm repo remote add`](gm-repo-remote-add.md)
- [`gm repo remote list`](gm-repo-remote-list.md)
- [`gm repo switch`](gm-repo-switch.md)

Expand Down
2 changes: 1 addition & 1 deletion docs/nu-git-manager-sugar/github/gm-gh-pr-checkout.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# `gm gh pr checkout` from `nu-git-manager-sugar github` (see [source](https://github.com/amtoine/nu-git-manager/blob/main/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/github.nu#L215))
# `gm gh pr checkout` from `nu-git-manager-sugar github` (see [source](https://github.com/amtoine/nu-git-manager/blob/main/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/github.nu#L217))
checkout one of the repo's PR interactively


Expand Down
2 changes: 1 addition & 1 deletion docs/nu-git-manager-sugar/github/gm-gh-query-api.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# `gm gh query-api` from `nu-git-manager-sugar github` (see [source](https://github.com/amtoine/nu-git-manager/blob/main/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/github.nu#L87))
# `gm gh query-api` from `nu-git-manager-sugar github` (see [source](https://github.com/amtoine/nu-git-manager/blob/main/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/github.nu#L89))
query the GitHub API for any end point

> :bulb: **Note**
Expand Down
2 changes: 1 addition & 1 deletion docs/nu-git-manager-sugar/github/gm-gh-query-releases.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# `gm gh query-releases` from `nu-git-manager-sugar github` (see [source](https://github.com/amtoine/nu-git-manager/blob/main/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/github.nu#L192))
# `gm gh query-releases` from `nu-git-manager-sugar github` (see [source](https://github.com/amtoine/nu-git-manager/blob/main/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/github.nu#L194))
list the releases of a GitHub repository

## Examples
Expand Down
2 changes: 1 addition & 1 deletion docs/nu-git-manager-sugar/github/gm-gh-query-user.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# `gm gh query-user` from `nu-git-manager-sugar github` (see [source](https://github.com/amtoine/nu-git-manager/blob/main/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/github.nu#L207))
# `gm gh query-user` from `nu-git-manager-sugar github` (see [source](https://github.com/amtoine/nu-git-manager/blob/main/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/github.nu#L209))
get information about a GitHub user

## Examples:
Expand Down
12 changes: 12 additions & 0 deletions docs/nu-git-manager-sugar/github/gm-gh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# `gm gh` from `nu-git-manager-sugar github` (see [source](https://github.com/amtoine/nu-git-manager/blob/main/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/github.nu#L64))




## Parameters


## Signatures
| input | output |
| ----- | ------ |
| `any` | `any` |
1 change: 1 addition & 0 deletions docs/nu-git-manager-sugar/github/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ provides helper commands to simplify the use of the GitHub CLI.
/!\ this module is part of the optional NGM. /!\

## Commands
- [`gm gh`](gm-gh.md)
- [`gm gh pr checkout`](gm-gh-pr-checkout.md)
- [`gm gh query-api`](gm-gh-query-api.md)
- [`gm gh query-releases`](gm-gh-query-releases.md)
Expand Down
Loading

0 comments on commit a8dfb12

Please sign in to comment.