Skip to content

Commit

Permalink
Merge pull request #7 from essentialkaos/develop
Browse files Browse the repository at this point in the history
Version 0.0.5
  • Loading branch information
andyone authored May 24, 2023
2 parents 38a9857 + 11b436b commit c4fed7d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,9 @@ Examples
ls -1 | path is-match '*.txt' && echo MATCH!
Check if all files in current directory is match to pattern
PATH_QUIET=1 path dir /path/to/file.txt
Run dir command in quiet mode enabled by environment variable
```

### CI Status
Expand Down
14 changes: 12 additions & 2 deletions cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import (
// Basic utility info
const (
APP = "path"
VER = "0.0.4"
VER = "0.0.5"
DESC = "Dead simple tool for working with paths"
)

Expand Down Expand Up @@ -91,6 +91,9 @@ var optMap = options.Map{
OPT_GENERATE_MAN: {Type: options.BOOL},
}

// quietMode is quiet mode flag
var quietMode bool

// ////////////////////////////////////////////////////////////////////////////////// //

// Run is main utility function
Expand Down Expand Up @@ -167,6 +170,8 @@ func configureUI() {
if options.GetB(OPT_NO_COLOR) {
fmtc.DisableColors = true
}

quietMode = options.GetB(OPT_QUIET) || os.Getenv("PATH_QUIET") != ""
}

// process starts arguments processing
Expand Down Expand Up @@ -220,7 +225,7 @@ func process(args options.Arguments) (error, bool) {

// printError prints error message to console
func printError(f string, a ...interface{}) {
if options.GetB(OPT_QUIET) {
if quietMode {
return
}

Expand Down Expand Up @@ -313,6 +318,11 @@ func genUsage() *usage.Info {
"Check if all files in current directory is match to pattern",
)

info.AddRawExample(
"PATH_QUIET=1 path "+CMD_DIRNAME+" /path/to/file.txt",
"Run "+CMD_DIRNAME+" command in quiet mode enabled by environment variable",
)

return info
}

Expand Down
5 changes: 4 additions & 1 deletion common/path.spec
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

Summary: Dead simple tool for working with paths
Name: path
Version: 0.0.4
Version: 0.0.5
Release: 0%{?dist}
Group: Applications/System
License: Apache License, Version 2.0
Expand Down Expand Up @@ -101,6 +101,9 @@ fi
################################################################################

%changelog
* Tue May 23 2023 Anton Novojilov <[email protected]> - 0.0.5-0
- Add support of enabling quiet mode using environment variable (PATH_QUIET)

* Wed May 17 2023 Anton Novojilov <[email protected]> - 0.0.4-0
- Improve input parsing

Expand Down

0 comments on commit c4fed7d

Please sign in to comment.