mirror of
https://github.com/RGBCube/nu_scripts
synced 2025-07-30 13:47:46 +00:00
Strip ANSI from the main branch name (#1139)
`find` highlights the returned value, which breaks the `gcm` macro, it returns ``` error: pathspec '?[37m?[0m?[41;37mmain?[0m?[37m?[0m' did not match any file(s) known to git ``` I opted in to using `ansi strip` instead of `--no-highlight`, because I think it covers wider range of nu shell versions
This commit is contained in:
parent
45934922f1
commit
6faa666e55
1 changed files with 1 additions and 0 deletions
|
@ -9,6 +9,7 @@ export def git_main_branch [] {
|
|||
| str trim
|
||||
| find --regex 'HEAD .*?[:: ].+'
|
||||
| first
|
||||
| ansi strip
|
||||
| str replace --regex 'HEAD .*?[:: ]\s*(.+)' '$1'
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue