Refactor and cleanup what needs to be #19
10 changed files with 10 additions and 73 deletions
|
@ -13,10 +13,8 @@ import (
|
|||
var appRemoveCmd = &cobra.Command{
|
||||
Use: "remove <app_client_id>",
|
||||
Short: "Remove an app",
|
||||
Long: `Remove the app with the given ID from the database.
|
||||
|
||||
If the app is not found in the database, no error is returned`,
|
||||
Args: cobra.ExactArgs(1),
|
||||
Long: `Remove the app with the given ID from the database.`,
|
||||
Args: cobra.ExactArgs(1),
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
removeApp(args[0])
|
||||
},
|
||||
|
|
|
@ -15,8 +15,8 @@ var appShowCmd = &cobra.Command{
|
|||
Short: "Display installed apps",
|
||||
Long: `Display the configuration for the apps.
|
||||
|
||||
Pass the commands without arguments to display the list of currently installed apps
|
||||
Pass the optional 'id' argument to display the configuration for this specific app`,
|
||||
Optional parameters:
|
||||
- app-id: id of the application to display. If empty, display the list of available apps instead`,
|
||||
Args: cobra.MaximumNArgs(1),
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
s := utils.InitStorage(utils.InitConfig(""))
|
||||
|
|
|
@ -9,13 +9,8 @@ import (
|
|||
|
||||
var backendCmd = &cobra.Command{
|
||||
Use: "backend",
|
||||
Short: "A brief description of your command",
|
||||
Long: `A longer description that spans multiple lines and likely contains examples
|
||||
and usage of using your command. For example:
|
||||
|
||||
Cobra is a CLI library for Go that empowers applications.
|
||||
This application is a tool to generate the needed files
|
||||
to quickly create a Cobra application.`,
|
||||
Short: "Handle authentication backends",
|
||||
Long: `Add, Remove or Show currently installed authentication backends`,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
fmt.Println("backend called")
|
||||
},
|
||||
|
|
|
@ -13,10 +13,8 @@ import (
|
|||
var backendRemoveCmd = &cobra.Command{
|
||||
Use: "remove <backend_id>",
|
||||
Short: "Remove a backend",
|
||||
Long: `Remove the backend with the given ID from the database.
|
||||
|
||||
If the backend is not found in the database, no error is returned`,
|
||||
Args: cobra.ExactArgs(1),
|
||||
Long: `Remove the backend with the given ID from the database.`,
|
||||
Args: cobra.ExactArgs(1),
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
removeBackend(args[0])
|
||||
},
|
||||
|
|
|
@ -15,8 +15,8 @@ var backendShowCmd = &cobra.Command{
|
|||
Short: "Display installed backends",
|
||||
Long: `Display the configuration for the backends.
|
||||
|
||||
Pass the commands without arguments to display the list of currently installed backends
|
||||
Pass the optional 'id' argument to display the configuration for this specific backend`,
|
||||
Optional parameters:
|
||||
- app-id: id of the backend to display. If empty, display the list of available backends instead`,
|
||||
Args: cobra.MaximumNArgs(1),
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
s := utils.InitStorage(utils.InitConfig(""))
|
||||
|
|
|
@ -52,14 +52,4 @@ func connectToDB(conf *config.AppConfig) error {
|
|||
|
||||
func init() {
|
||||
dbCmd.AddCommand(connectCmd)
|
||||
|
||||
// Here you will define your flags and configuration settings.
|
||||
|
||||
// Cobra supports Persistent Flags which will work for this command
|
||||
// and all subcommands, e.g.:
|
||||
// dbCmd.PersistentFlags().String("foo", "", "A help for foo")
|
||||
|
||||
// Cobra supports local flags which will only run when this command
|
||||
// is called directly, e.g.:
|
||||
// dbCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
|
||||
}
|
||||
|
|
|
@ -14,14 +14,4 @@ var dbCmd = &cobra.Command{
|
|||
|
||||
func init() {
|
||||
cmd.RootCmd.AddCommand(dbCmd)
|
||||
|
||||
// Here you will define your flags and configuration settings.
|
||||
|
||||
// Cobra supports Persistent Flags which will work for this command
|
||||
// and all subcommands, e.g.:
|
||||
// dbCmd.PersistentFlags().String("foo", "", "A help for foo")
|
||||
|
||||
// Cobra supports local flags which will only run when this command
|
||||
// is called directly, e.g.:
|
||||
// dbCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
|
||||
}
|
||||
|
|
|
@ -47,14 +47,4 @@ func deleteDB(conf *config.AppConfig) error {
|
|||
|
||||
func init() {
|
||||
dbCmd.AddCommand(destroyCmd)
|
||||
|
||||
// Here you will define your flags and configuration settings.
|
||||
|
||||
// Cobra supports Persistent Flags which will work for this command
|
||||
// and all subcommands, e.g.:
|
||||
// dbCmd.PersistentFlags().String("foo", "", "A help for foo")
|
||||
|
||||
// Cobra supports local flags which will only run when this command
|
||||
// is called directly, e.g.:
|
||||
// dbCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
|
||||
}
|
||||
|
|
|
@ -12,9 +12,6 @@ var RootCmd = &cobra.Command{
|
|||
Short: "You're in their DMs, I'm in their SSO",
|
||||
Long: `PolyculeConnect is a SSO OpenIDConnect provider which allows multiple authentication backends,
|
||||
and enables authentication federation among several infrastructures.`,
|
||||
// Uncomment the following line if your bare application
|
||||
// has an action associated with it:
|
||||
// Run: func(cmd *cobra.Command, args []string) { },
|
||||
}
|
||||
|
||||
// Execute adds all child commands to the root command and sets flags appropriately.
|
||||
|
@ -27,16 +24,5 @@ func Execute() {
|
|||
}
|
||||
|
||||
func init() {
|
||||
// Here you will define your flags and configuration settings.
|
||||
// Cobra supports persistent flags, which, if defined here,
|
||||
// will be global for your application.
|
||||
|
||||
// rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.polyculeconnect.yaml)")
|
||||
|
||||
// Cobra also supports local flags, which will only run
|
||||
// when this action is called directly.
|
||||
// rootCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
|
||||
|
||||
// Disable the default `completion` command to generate the autocompletion files
|
||||
RootCmd.Root().CompletionOptions.DisableDefaultCmd = true
|
||||
}
|
||||
|
|
|
@ -113,15 +113,5 @@ func serve() {
|
|||
|
||||
func init() {
|
||||
cmd.RootCmd.AddCommand(serveCmd)
|
||||
|
||||
// Here you will define your flags and configuration settings.
|
||||
|
||||
// Cobra supports Persistent Flags which will work for this command
|
||||
// and all subcommands, e.g.:
|
||||
// serveCmd.PersistentFlags().String("foo", "", "A help for foo")
|
||||
|
||||
// Cobra supports local flags which will only run when this command
|
||||
// is called directly, e.g.:
|
||||
// serveCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
|
||||
serveCmd.Flags().StringVarP(&configPath, "config", "c", "config.json", "Path to the JSON configuration file")
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue