Skip to content

Commit

Permalink
Omit empty strings for manifest show
Browse files Browse the repository at this point in the history
  • Loading branch information
saheljalal committed Oct 9, 2019
1 parent 70afa55 commit 783bfdf
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
nostromo is a CLI to manage aliases through simple commands to add and remove scoped aliases and substitutions.

<p align="center">
<img src="images/nostromo-manifest-show.png" alt="nostromo">
<img src="images/nostromo-manifest-show.png" alt="nostromo">
</p>

Managing aliases can be tedious and difficult to set up. nostromo makes this process easy and reliable. The tool adds shortcuts to your `.bashrc` / `.zshrc` that call into the nostromo binary. It reads and manages all aliases within its manifest. This is used to find and execute the actual command as well as swap any substitutions to simplify calls.
Expand Down
Binary file modified images/nostromo-manifest-show.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 8 additions & 2 deletions log/fieldmapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,19 @@ func Fields(mapper FieldMapper) {
if value == nil || omitKey(key) {
continue
}

svalue := fmt.Sprint(value)
if len(svalue) == 0 {
continue
}

if !opt.verbose {
fmt.Print(opt.theme.formatStyle(keyFieldStyle, key))
fmt.Print(opt.theme.formatStyle(valueFieldStyle, ": "+fmt.Sprint(value)))
fmt.Print(opt.theme.formatStyle(valueFieldStyle, ": "+svalue))
fmt.Print(" ")
} else {
fmt.Print(opt.theme.formatStyle(keyFieldStyle, key))
fmt.Println(opt.theme.formatStyle(valueFieldStyle, ": "+fmt.Sprint(value)))
fmt.Println(opt.theme.formatStyle(valueFieldStyle, ": "+svalue))
}
}
if !opt.verbose {
Expand Down

0 comments on commit 783bfdf

Please sign in to comment.