From 19ceb0837251241a0717935e9ed6cb9fef310b52 Mon Sep 17 00:00:00 2001 From: Andrew Scott Date: Sun, 12 Jun 2016 14:01:10 +0100 Subject: [PATCH] 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", } } --- powerlevel9k.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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