-
-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extract message printing code and output config
- Loading branch information
1 parent
b57079e
commit 05a94dc
Showing
8 changed files
with
98 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,31 @@ | ||
package cmd | ||
|
||
import ( | ||
"errors" | ||
|
||
"github.com/TylerBrock/saw/config" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var getConfig config.Configuration | ||
|
||
var Get = &cobra.Command{ | ||
var GetCommand = &cobra.Command{ | ||
Use: "get", | ||
Short: "Get log events", | ||
Long: "", | ||
Args: func(cmd *cobra.Command, args []string) error { | ||
if len(args) < 1 { | ||
return errors.New("listing streams requires log group argument") | ||
} | ||
return nil | ||
}, | ||
Run: func(cmd *cobra.Command, args []string) { | ||
//b := blade.NewBlade(&getConfig) | ||
}, | ||
} | ||
|
||
func init() { | ||
GetCommand.Flags().StringVar(&groupsConfig.Prefix, "prefix", "", "log group prefix filter") | ||
GetCommand.Flags().StringVar(&groupsConfig.Start, "start", "", "start getting the logs from this point") | ||
GetCommand.Flags().StringVar(&groupsConfig.End, "end", "now", "stop getting the logs at this point") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package config | ||
|
||
import ( | ||
"github.com/TylerBrock/colorjson" | ||
"github.com/fatih/color" | ||
) | ||
|
||
type OutputConfiguration struct { | ||
Expand bool | ||
Raw bool | ||
RawString bool | ||
ShowStreamName bool | ||
Invert bool | ||
NoColor bool | ||
} | ||
|
||
func (c *OutputConfiguration) Formatter() *colorjson.Formatter { | ||
var formatter *colorjson.Formatter = colorjson.NewFormatter() | ||
|
||
if c.Expand { | ||
formatter.Indent = 4 | ||
} | ||
|
||
if c.RawString { | ||
formatter.RawStrings = true | ||
} | ||
|
||
if c.Invert { | ||
formatter.KeyColor = color.New(color.FgBlack) | ||
} | ||
|
||
if c.NoColor { | ||
color.NoColor = true | ||
} | ||
|
||
return formatter | ||
} |