Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
Updated readme to include html output example

Updated TODO

Added html_output.png in assets/images

Added version and ouput error on Execute error
  • Loading branch information
ondrovic committed Aug 29, 2024
1 parent d58c307 commit 7fe4575
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 11 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ To parse a MassCode database file located at `/path/to/db.json` and export the r
```bash
mass-code-parser /path/to/db.json --output --output-path="/path/to/output" --output-type="html"
```
![html output example](assets/images/html_output.png)

### Flags

Expand Down
3 changes: 2 additions & 1 deletion TODO
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
project:
✔ add version info @done(24-08-29 15:31)
goreleaser.yaml:
project_name:
✔ replace PLACEHOLDER with actual name @done(24-08-27 12:44)
Expand All @@ -11,4 +12,4 @@ project:
☐ write tests
.github:
workflows:
verify everythign is setup
verify everythign is setup @done(24-08-29 15:25)
Binary file added assets/images/html_output.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 14 additions & 10 deletions cli/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,30 @@ import (
"github.com/spf13/viper"
)

var rootCmd = &cobra.Command{
Use: "mass-code-parser <path-to-db.json> [flags]",
Short: "Parse and export MassCode database",
Long: `A tool to parse and export MassCode database in various formats.`,
Args: cobra.ExactArgs(1),
RunE: run,
}
var (
version string

rootCmd = &cobra.Command{
Use: "mass-code-parser <path-to-db.json> [flags]",
Short: "Parse and export MassCode database",
Long: `A tool to parse and export MassCode database in various formats.`,
Args: cobra.ExactArgs(1),
RunE: run,
Version: formatters.GetVersion(version, "0.0.0-local-dev"),
}
)

func init() {
rootCmd.Flags().BoolP("output", "o", false, "Export results to a file")
rootCmd.Flags().StringP("output-path", "p", "", "Path for the output file (without extension)")
rootCmd.Flags().StringP("output-type", "t", "txt", "Output type: text, html, or json")
rootCmd.Flags().StringP("output-type", "t", "html", "Output type: text, html, or json")

viper.BindPFlags(rootCmd.Flags())
}

func Execute() {
if err := rootCmd.Execute(); err != nil {
// fmt.Println(err)
// os.Exit(1)
fmt.Println(err)
return
}
}
Expand Down

0 comments on commit 7fe4575

Please sign in to comment.