summaryrefslogtreecommitdiff
path: root/powerlevel9k.zsh-theme
diff options
context:
space:
mode:
authorAndrew Scott <andj.scott@gmail.com>2016-06-12 16:01:10 +0300
committerAndrew Scott <andj.scott@gmail.com>2016-06-12 16:50:22 +0300
commit19ceb0837251241a0717935e9ed6cb9fef310b52 (patch)
tree5cb9af7d1ea0c06522b256db499db3e02c14e949 /powerlevel9k.zsh-theme
parent41888bf2a96e13a33db696c51963986472c9d91f (diff)
Only match first name in package.json
This ensures that the following package.json extract would just give the prompt "foo" rather than "foo\nbar". { "name": "foo", "author": { "name": "bar", } }
Diffstat (limited to 'powerlevel9k.zsh-theme')
-rwxr-xr-xpowerlevel9k.zsh-theme2
1 files changed, 1 insertions, 1 deletions
diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme
index 4206bf51..cb5f68ea 100755
--- a/powerlevel9k.zsh-theme
+++ b/powerlevel9k.zsh-theme
@@ -489,7 +489,7 @@ prompt_dir() {
# Parse the 'name' from the package.json; if there are any problems, just
# print the file path
- if name=$( cat "$package_path/package.json" 2> /dev/null | grep "\"name\""); then
+ if name=$( cat "$package_path/package.json" 2> /dev/null | grep -m 1 "\"name\""); then
name=$(echo $name | awk -F ':' '{print $2}' | awk -F '"' '{print $2}')
# Instead of printing out the full path, print out the name of the package