Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework of CLI + Cobra #69

Merged
merged 39 commits into from
Jun 5, 2021
Merged
Changes from 1 commit
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
1b7f188
Added new print module
Foxboron May 16, 2021
955c547
Added more fidelity to the logging methods
Foxboron May 16, 2021
0d249b2
Added bundle cli format
Foxboron May 16, 2021
7a4defc
Added deps
Foxboron May 16, 2021
431363f
Added list-files new WIP for commands
Foxboron May 16, 2021
62d653d
Added status new format
Foxboron May 16, 2021
2a53d52
Added list-bundles setup
Foxboron May 16, 2021
a05e6c8
Fixed commands with colors off
Foxboron May 16, 2021
bb78cf9
Remove previous logging, improve error bubling
Foxboron May 16, 2021
b82e17e
Return errors when generating bundles
Foxboron May 16, 2021
3568e9d
sbctl: Buble up errors from the "library"
Foxboron May 16, 2021
1508b29
Moved json out function
Foxboron May 17, 2021
23381e0
Added NotOK instead of "Error". Makes more sense semantically
Foxboron May 17, 2021
3d7f094
Added an iter function
Foxboron May 17, 2021
fb9b3c7
🤷
Foxboron May 17, 2021
30e16f5
Catch for unknown command
Foxboron May 17, 2021
70b00f3
Added new error
Foxboron May 18, 2021
d0022cb
Added BundleIter
Foxboron May 18, 2021
877ab49
Implement GetGUID
Foxboron May 18, 2021
adadb52
Give status the ability to display owner GUID
Foxboron May 18, 2021
3505f1b
New structure
Foxboron May 18, 2021
a5e0551
GUID package
Foxboron May 18, 2021
342ba34
Fixup
Foxboron May 18, 2021
235238c
Fixed lint issues
Foxboron May 18, 2021
f01453a
Change immutable error a little bit
Foxboron May 18, 2021
97435cc
More internal restructuring
Foxboron May 18, 2021
3454841
Moved create-keys top-level
Foxboron May 18, 2021
a318695
Moved generate-bundles top-level
Foxboron May 18, 2021
3f05d1d
Propegate errors better
Foxboron May 18, 2021
6dfc186
enroll changes
Foxboron May 19, 2021
b49ebbb
Added CanVerifyFiles
Foxboron May 19, 2021
8b4fc40
Added internal functions for checked paths, and CheckMSDos
Foxboron May 19, 2021
0d12167
Move verify to top-level
Foxboron May 19, 2021
fe514e1
Added errors to WriteFileDatabase
Foxboron May 19, 2021
6b0242c
Added print layout for key syncing
Foxboron May 19, 2021
57a1c93
Remove last of the log.* stuff
Foxboron May 19, 2021
ba0cee8
Make lint happy
Foxboron May 19, 2021
550b4e6
Move global flags to persistent
Foxboron May 22, 2021
ae1aec1
sbctl: Ensure all commands inherit stdout turning off
Foxboron May 30, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added more fidelity to the logging methods
Signed-off-by: Morten Linderud <morten@linderud.pw>
  • Loading branch information
Foxboron committed May 30, 2021
commit 955c547743acb080d1b8ad5d739d220d3acf3abf
34 changes: 28 additions & 6 deletions logging/logging.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,26 +49,48 @@ func Print(msg string, a ...interface{}) {
PrintWithFile(os.Stdout, msg, a...)
}

func Println(msg string) {
PrintWithFile(os.Stdout, msg+"\n")
}

func Okf(m string, a ...interface{}) string {
return fmt.Sprintf("%s %s\n", ok, fmt.Sprintf(m, a...))
}

// Print ok string to stdout
func Ok(m string, a ...interface{}) {
Print(fmt.Sprintf("%s %s\n", ok, fmt.Sprintf(m, a...)))
Print(Okf(m, a...))
}

func Errorf(m string, a ...interface{}) string {
return fmt.Sprintf("%s %s\n", err, fmt.Sprintf(m, a...))
}

func Error(m string, a ...interface{}) {
Print(fmt.Sprintf("%s %s\n", err, fmt.Sprintf(m, a...)))
Print(Errorf(m, a...))
}

func Unknownf(m string, a ...interface{}) string {
return fmt.Sprintf("%s %s\n", unkwn, fmt.Sprintf(m, a...))
}

func Unknown(m string, a ...interface{}) {
Print(fmt.Sprintf("%s %s\n", unkwn, fmt.Sprintf(m, a...)))
Print(Unknownf(m, a...))
}

func Warnf(m string, a ...interface{}) string {
return fmt.Sprintf("%s %s\n", warn, fmt.Sprintf(m, a...))
}
func Warn(m string, a ...interface{}) {
Print(fmt.Sprintf("%s %s\n", warn, fmt.Sprintf(m, a...)))
Print(Warnf(m, a...))
}

func Fatalf(m string, a ...interface{}) string {
return color.New(color.FgRed, color.Bold).Sprintf("%s %s\n", UnkwnSym, fmt.Sprintf(m, a...))
}

func Fatal(err error) {
m := color.New(color.FgRed, color.Bold).Sprintf("%s %s", UnkwnSym, err.Error())
PrintWithFile(os.Stderr, m)
PrintWithFile(os.Stderr, Fatalf(err.Error()))
}

func init() {
Expand Down