Dotfiles/site-modules/core/files/nushell/scripts/sapling.nu
Ade Attwood dc23131046 feat(nu): setup nushell and start off the config
This is some investigation in to nushell will work. I will be looking to use
this cross platform, as zsh will not work on windows.

Adds some of the core modules so I don't loose my mind having to relearn mussel
memory. The goal of this is to replicate my use of oh-my-zsh, I think this will
take some time, I have sunk years into the zsh config. The aliases will be the
same, the GOPATH project structure will be replicated and the dir hooks will be
implemeted so my PATH gets setup just as I like it.
2024-12-08 10:55:05 +00:00

42 lines
998 B
Text

# Helper functions and aliases for working with sapling scm
#
# https://sapling-scm.com/
# Internal alias to rename sl
export alias _sl = sl
# Sapling CLI tool, aliases for `sl`
export alias s = _sl
# Sapling log for your current stack
export alias sl = _sl log --pager never --remote -r '.::top() or last(::., 40)'
# Sapling diff
export alias sd = _sl diff
# Sapling status
export alias ss = _sl status
# Wrapper arround `sl addremove` and `sl amend` commands
export def --wrapped sa [
...args # Agguments you can pass to `sl amend` command
] {
_sl addremove '.'
_sl amend -iv ...$args
}
# Wrapper arround `sl addremove` and `sl commit` commands
export def --wrapped sc [
...args # Agguments you can pass to `sl commit` command
] {
_sl addremove '.'
_sl commit -iv ...$args
}
export def sco [] {
let raw_commit = (_sl log -r 'heads(draft())' | fzf --ansi)
if ($raw_commit | str length) > 0 {
let commit = ($raw_commit | split words | get 1);
_sl goto $commit
}
}