Skip to content

Commit

Permalink
fix the documentation (#137)
Browse files Browse the repository at this point in the history
## changelog
- rewrite all the documentation as valid Markdown
- write missing documentation for `gm repo query` from #127 
- fix the signatures of
    - `repo-root` in 1def047
    - `gm repo branch interactive-delete` in a7e8af3
    - `gm repo fetch branch` in 7eccea4
    - `gm repo compare` in 8c19f70
    - `gm repo branch wipe` in ccba886
    - `gm gh pr checkout` in d1557ac
    - `prompt setup` in d2e0c07
- regenerate the documentation
  • Loading branch information
amtoine authored Dec 13, 2023
1 parent 0c17038 commit 3c67d27
Show file tree
Hide file tree
Showing 32 changed files with 747 additions and 442 deletions.
24 changes: 21 additions & 3 deletions docs/nu-git-manager-sugar/extra/gm-report.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,26 @@
# `nu-git-manager-sugar extra gm report`
## Description
# `gm report` (`nu-git-manager-sugar extra`)
get a full report about the local store of repositories


## Examples
```nushell
gm report | columns
```
```
╭────┬───────────╮
│ 0 │ name │
│ 1 │ branch │
│ 2 │ remote │
│ 3 │ tag │
│ 4 │ index │
│ 5 │ ignored │
│ 6 │ conflicts │
│ 7 │ ahead │
│ 8 │ behind │
│ 9 │ worktree │
│ 10 │ stashes │
│ 11 │ clean │
╰────┴───────────╯
```

## Parameters

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# `nu-git-manager-sugar git gm repo branch interactive-delete`
## Description
# `gm repo branch interactive-delete` (`nu-git-manager-sugar git`)
remove a branch interactively


Expand All @@ -8,6 +7,6 @@ remove a branch interactively


## Signatures
| input | output |
| ----- | ------ |
| `any` | `any` |
| input | output |
| --------- | --------- |
| `nothing` | `nothing` |
9 changes: 4 additions & 5 deletions docs/nu-git-manager-sugar/git/gm-repo-branch-wipe.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# `nu-git-manager-sugar git gm repo branch wipe`
## Description
# `gm repo branch wipe` (`nu-git-manager-sugar git`)
wipe a branch completely, i.e. both locally and remotely


Expand All @@ -18,6 +17,6 @@ wipe a branch completely, i.e. both locally and remotely
- description: the remote to push to

## Signatures
| input | output |
| ----- | ------ |
| `any` | `any` |
| input | output |
| --------- | --------- |
| `nothing` | `nothing` |
19 changes: 11 additions & 8 deletions docs/nu-git-manager-sugar/git/gm-repo-branches.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
# `nu-git-manager-sugar git gm repo branches`
## Description
# `gm repo branches` (`nu-git-manager-sugar git`)
inspect local 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
list branches and their associated remotes
> gm repo branches

clean all dangling branches
> gm repo branches --clean
## Examples
```nushell
# list branches and their associated remotes
gm repo branches
```
---
```nushell
# clean all dangling branches
gm repo branches --clean
```

## Parameters
- parameter_name: clean
Expand Down
9 changes: 4 additions & 5 deletions docs/nu-git-manager-sugar/git/gm-repo-compare.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# `nu-git-manager-sugar git gm repo compare`
## Description
# `gm repo compare` (`nu-git-manager-sugar git`)
compare the changes between two revisions, from a target to the "head"


Expand All @@ -19,6 +18,6 @@ compare the changes between two revisions, from a target to the "head"
- parameter_default: HEAD

## Signatures
| input | output |
| ----- | ------ |
| `any` | `any` |
| input | output |
| --------- | -------- |
| `nothing` | `string` |
9 changes: 4 additions & 5 deletions docs/nu-git-manager-sugar/git/gm-repo-fetch-branch.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# `nu-git-manager-sugar git gm repo fetch branch`
## Description
# `gm repo fetch branch` (`nu-git-manager-sugar git`)
fetch a remote branch locally, without pulling down the whole remote


Expand All @@ -25,6 +24,6 @@ fetch a remote branch locally, without pulling down the whole remote
- parameter_default: none

## Signatures
| input | output |
| ----- | ------ |
| `any` | `any` |
| input | output |
| --------- | --------- |
| `nothing` | `nothing` |
19 changes: 11 additions & 8 deletions docs/nu-git-manager-sugar/git/gm-repo-get-commit.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
# `nu-git-manager-sugar git gm repo get commit`
## Description
# `gm repo get commit` (`nu-git-manager-sugar git`)
get the commit hash of any revision

# Examples
get the commit hash of the currently checked out revision
> gm repo get commit

get the commit hash of the main branch
> gm repo get commit main
## Examples
```nushell
# get the commit hash of the currently checked out revision
gm repo get commit
```
---
```nushell
# get the commit hash of the main branch
gm repo get commit main
```

## Parameters
- parameter_name: revision
Expand Down
15 changes: 9 additions & 6 deletions docs/nu-git-manager-sugar/git/gm-repo-goto-root.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
# `nu-git-manager-sugar git gm repo goto root`
## Description
# `gm repo goto root` (`nu-git-manager-sugar git`)
go to the root of the repository from anywhere in the worktree

# Examples
go back to the root of a repo
> cd foo/bar/baz; gm repo goto root; print (pwd)
/path/to/repo
## Examples
```nushell
# go back to the root of a repo
cd foo/bar/baz; gm repo goto root; print (pwd)
```
```
/path/to/repo
```

## Parameters

Expand Down
27 changes: 17 additions & 10 deletions docs/nu-git-manager-sugar/git/gm-repo-is-ancestor.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
# `nu-git-manager-sugar git gm repo is-ancestor`
## Description
# `gm repo is-ancestor` (`nu-git-manager-sugar git`)
return true iif the first revision is an ancestor of the second

# Examples
HEAD~20 is an ancestor of HEAD
> gm repo is-ancestor HEAD~20 HEAD
true

HEAD is never an ancestor of HEAD~20
> gm repo is-ancestor HEAD HEAD~20
false
## Examples
```nushell
# HEAD~20 is an ancestor of HEAD
gm repo is-ancestor HEAD~20 HEAD
```
```
true
```
---
```nushell
# HEAD is never an ancestor of HEAD~20
gm repo is-ancestor HEAD HEAD~20
```
```
false
```

## Parameters
- parameter_name: a
Expand Down
3 changes: 1 addition & 2 deletions docs/nu-git-manager-sugar/git/gm-repo-ls.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# `nu-git-manager-sugar git gm repo ls`
## Description
# `gm repo ls` (`nu-git-manager-sugar git`)
get some information about a repo


Expand Down
28 changes: 24 additions & 4 deletions docs/nu-git-manager-sugar/git/gm-repo-query.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,28 @@
# `nu-git-manager-sugar git gm repo query`
## Description
TODO: documentation

# `gm repo query` (`nu-git-manager-sugar git`)
queries the `.git/` directory as a database with `nu_plugin_git_query`

## Examples
```nushell
# get the commits of the current repo
gm repo query commits
```
---
```nushell
# get the total number of insertions and deletions per author
gm repo query diffs
| group-by name
| transpose author data
| insert insertions { get data.insertions | math sum }
| insert deletions { get data.deletions | math sum }
| reject data
```
```
#┬────author────┬insertions┬deletions
0│amtoine │ 6770│ 5402
1│Antoine Stevan│ 8537│ 4562
2│Mel Massadian │ 654│ 64
─┴──────────────┴──────────┴─────────
```

## Parameters
- parameter_name: table
Expand Down
20 changes: 11 additions & 9 deletions docs/nu-git-manager-sugar/git/gm-repo-remote-list.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
# `nu-git-manager-sugar git gm repo remote list`
## Description
# `gm repo remote list` (`nu-git-manager-sugar git`)
get the list of all the remotes in the current repository
# Examples
list all the remotes in a default `nu-git-manager` repo
> gm repo remote list
#┬remote┬──────────────────fetch──────────────────┬─────────────────push──────────────────
0│origin│https://github.com/amtoine/nu-git-manager│ssh://github.com/amtoine/nu-git-manager
─┴──────┴─────────────────────────────────────────┴───────────────────────────────────────


## Examples
```nushell
# list all the remotes in a default `nu-git-manager` repo
gm repo remote list
```
```
#┬remote┬──────────────────fetch──────────────────┬─────────────────push──────────────────
0│origin│https://github.com/amtoine/nu-git-manager│ssh://github.com/amtoine/nu-git-manager
─┴──────┴─────────────────────────────────────────┴───────────────────────────────────────
```

## Parameters

Expand Down
3 changes: 1 addition & 2 deletions docs/nu-git-manager-sugar/git/gm-repo-switch.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# `nu-git-manager-sugar git gm repo switch`
## Description
# `gm repo switch` (`nu-git-manager-sugar git`)
switch between branches interactively


Expand Down
73 changes: 50 additions & 23 deletions docs/nu-git-manager-sugar/git/prompt/setup.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,58 @@
# `nu-git-manager-sugar git prompt setup`
## Description
# `setup` (`nu-git-manager-sugar git prompt`)
setup the Git prompt of NGM

the different sections of the prompt are the following, in order and separated by a single space:
- "admin_segment": shows if you are an admin of the session
- "pwd": shows the current working directory, in long form outside of a repo or with only the
- "_admin_": shows if you are an admin of the session
- "_pwd_": shows the current working directory, in long form outside of a repo or with only the
basename if inside a Git repo
- "git_branch_segment": if inside a Git repo, will show the current branch, the tag or the
- "_Git branch_": if inside a Git repo, will show the current branch, the tag or the
detached revision
- "git_action_segment": if inside a Git repo and performing a Git action, such as a MERGE or a
- "_Git action_": if inside a Git repo and performing a Git action, such as a MERGE or a
REBASE, the prompt will show the stage of the action
- "duration_segment": if the last command took longer than the `--duration-threshold`, the prompt
- "_duration_": if the last command took longer than the `--duration-threshold`, the prompt
will show the exact duration
- "command_failed_segment": if the last command failed, the exit code will be shown
- "login_segment": shows if you are in a login session
- "_command failed_": if the last command failed, the exit code will be shown
- "_login_": shows if you are in a login session

# Examples
setup the prompt with 10sec of command duration and `> ` as the Vi indicator
> export-env {
use nu-git-manager-sugar git-prompt setup
setup --duration-threshold 10sec --indicators {
vi: {
insert: "> "
normal: "> "
}
}
}
## the look
- outside of a Git repo
```
~/documents/repos/github.com >
```
- on a branch
```
nu-git-manager (main:c2242b4) >
```
- with the `HEAD` detached
```
nu-git-manager (_:adca8cb) >
```
- on a tag
```
nu-git-manager (0.3.0:3fb5c89) >
```
- during a rebase
```
nu-git-manager (_:5d8245d) (REBASE-i) >
```
- inside a subdirectory
```
nu-git-manager/src/nu-git-manager (main:c2242b4) >
```

## Examples
```nushell
# setup the prompt with 10sec of command duration and `> ` as the Vi indicator
export-env {
use nu-git-manager-sugar git-prompt setup
setup --duration-threshold 10sec --indicators {
vi: {
insert: "> "
normal: "> "
}
}
}
```

## Parameters
- parameter_name: indicators
Expand All @@ -42,6 +69,6 @@ the different sections of the prompt are the following, in order and separated b
- parameter_default: 1sec

## Signatures
| input | output |
| ----- | ------ |
| `any` | `any` |
| input | output |
| --------- | --------- |
| `nothing` | `nothing` |
9 changes: 4 additions & 5 deletions docs/nu-git-manager-sugar/github/gm-gh-pr-checkout.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# `nu-git-manager-sugar github gm gh pr checkout`
## Description
# `gm gh pr checkout` (`nu-git-manager-sugar github`)
checkout one of the repo's PR interactively


Expand All @@ -8,6 +7,6 @@ checkout one of the repo's PR interactively


## Signatures
| input | output |
| ----- | ------ |
| `any` | `any` |
| input | output |
| --------- | --------- |
| `nothing` | `nothing` |
Loading

0 comments on commit 3c67d27

Please sign in to comment.