Skip to content

Commit

Permalink
[feat]: add terse option for version command (#24)
Browse files Browse the repository at this point in the history
e.g.:

```bash
codeedit version --terse
# or
codeedit version -t 
# will output: 
0.0.8
```

in comparison:

```bash
codeedit version
# will output:
CodeEditCLI: 	0.0.8
CodeEdit.app: 	0.0.1
```
  • Loading branch information
lukepistrol authored Jan 12, 2023
2 parents ccba6c8 + 8aad250 commit eea4539
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions Sources/CodeEditCLI/Version.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,16 @@ extension CodeEditCLI {
abstract: "Prints the version of the CLI and CodeEdit.app."
)

@Flag(name: .shortAndLong, help: "Only prints the version number of the CLI")
var terse = false

func run() throws {
// if terse flag is set only print the cli version number
if terse {
print(CLI_VERSION)
return
}

// Print the cli version
print("CodeEditCLI: \t\(CLI_VERSION)")

Expand Down
2 changes: 1 addition & 1 deletion Sources/CodeEditCLI/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import Foundation
// ##################################################
// This needs to be changed prior to every release!
// ##################################################
let CLI_VERSION = "0.0.8"
let CLI_VERSION = "0.0.9"

struct CodeEditCLI: ParsableCommand {
static let configuration = CommandConfiguration(
Expand Down

0 comments on commit eea4539

Please sign in to comment.