1
Fork 0
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:
Filipp Samoilov 2025-06-30 14:25:48 +03:00 committed by GitHub
parent 45934922f1
commit 6faa666e55
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -9,6 +9,7 @@ export def git_main_branch [] {
| str trim
| find --regex 'HEAD .*?[: ].+'
| first
| ansi strip
| str replace --regex 'HEAD .*?[: ]\s*(.+)' '$1'
}