-
Notifications
You must be signed in to change notification settings - Fork 1
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
Feature/cobra cli #79
Changes from 1 commit
898a847
764ba9d
eb1300e
e9a4504
2ac6337
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package cmd | ||
|
||
import ( | ||
"os" | ||
|
||
"github.com/spf13/cobra" | ||
) | ||
|
||
var rootCmd = &cobra.Command{ | ||
Use: "cmd", | ||
Short: "CLI app for interacting with a SciCat instance", | ||
Long: `This library comprises a few subcommands for managing SciCat | ||
and datasets on it, as well as interacting with the archival system connected | ||
to it.`, | ||
// uncomment the next line if there's a default action | ||
// Run: func(cmd *cobra.Command, args []string) { }, | ||
} | ||
|
||
func Execute() { | ||
err := rootCmd.Execute() | ||
if err != nil { | ||
os.Exit(1) | ||
} | ||
} | ||
|
||
func init() { | ||
rootCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package main | ||
|
||
import cmd "github.com/paulscherrerinstitute/scicat/cmd/commands" | ||
|
||
func main() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. could we test here that when we call this main with an arg (e.g. datasetIngestor) the datasetIngestor from There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have done something similar to that in the latest commit (calling Execute() instead of main, but it does effectively the same thing) |
||
cmd.Execute() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe remove the comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I might add a default action since the version parameter is common between all commands