32
loading...
This website collects cookies to deliver better user experience
npm install
.😬 I use npmrc to create registry profiles and quickly switch between them, but with my chaotic days I don't usually remember which profile I have set!// ~/.config/starship.toml
[custom.npmrc]
disabled = false
command = """
NPMREGISTRY=$(command npm config get registry)
if [[ "$NPMREGISTRY" =~ "clientregistrynamespace" ]]; then
NPMREGISTRY_SYMBOL=""
else
NPMREGISTRY_SYMBOL=" "
fi
echo "registry $NPMREGISTRY_SYMBOL"
"""
when = "true"
style = "bold blue"
npm config get registry
and converting the output of the command to a string variable for comparison with the $
. The command spits out https://registry.npmjs.org/
or whatever registry you're currently on. A custom registry url might look something like https://npm.clientregistrynamespace.com
. I'm checking to see if my clients registry name is in the command output - if it is, I'm returning a symbol representing that client, and if it isn't I'm returning an NPM icon from Nerd Fonts.32