amtoine / nu-git-manager

A collection of Nushell tools to manage Git repositories.
GNU General Public License v3.0
27 stars 2 forks source link

some ideas from `nu_scripts` #7

Open amtoine opened 1 year ago

amtoine commented 1 year ago

in the nushell/nu_scripts repo, we have the following files that could be interesting at some point

╭───┬───────────────────────────────────────────────────────────╮
│ 0 │ aliases/git/nu_alias_git.nu                               │
│ 1 │ custom-completions/auto-generate/completions/git-sizer.nu │
│ 2 │ custom-completions/auto-generate/completions/git.nu       │
│ 3 │ custom-completions/auto-generate/completions/gitk.nu      │
│ 4 │ modules/git/git.nu                                        │
│ 5 │ modules/git/git_branch_cleanup.nu                         │
│ 6 │ modules/prompt/async_git_prompt/async-git-prompt.nu       │
│ 7 │ modules/prompt/panache-git.nu                             │
│ 8 │ modules/prompt/powerline/power_git.nu                     │
│ 9 │ sourced/cool-oneliners/git_gone.nu                        │
╰───┴───────────────────────────────────────────────────────────╯

Note generated with fd git | lines | find --invert themes before_v0.60 github gitlab custom-completions/git | find --invert --regex '/$'

there are also a bunch of things scattered around in my nu_scripts :+1: especially

amtoine commented 1 year ago

e.g. this command which might need to be reworked if the enter command gets removed from nushhell :+1:

def list-repos [] {
    ghq list
    | lines
    | str replace $"($env.GIT_REPOS_HOME)/" ""
    | str replace "/.git$" ""
    | sort --ignore-case
}

export def-env "repo enter" [] {
    let choice = (
        list-repos
        | to text
        | fzf --ansi --prompt "Please choose a repo to enter: "
        | str trim
    )

    if ($choice | is-empty) {
        print "user choose to exit..."
        return
    }

    enter ($env.GIT_REPOS_HOME | path join $choice)

    print "Opened shells:"
    shells
}
amtoine commented 1 year ago

from the discord server

def get-commit-file [] {
    git rev-parse --show-toplevel
    | str trim
    | path join ".git" "gcf-commit-msg.txt"

}

export def gcf [] {
    let file = (get-commit-file)

    git commit -F $file
    "" | save -f $file
}

export def gcfe [] {
    ^$env.EDITOR (get-commit-file)
}