50 lines
1.5 KiB
Go
50 lines
1.5 KiB
Go
/*
|
|
Copyright © 2023 NAME HERE <EMAIL ADDRESS>
|
|
*/
|
|
package cmd
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
var (
|
|
backendID string
|
|
backendName string
|
|
backendIssuer string
|
|
)
|
|
|
|
// backendAddCmd represents the add command
|
|
var backendAddCmd = &cobra.Command{
|
|
Use: "add",
|
|
Short: "Add a new backend to the storage",
|
|
Long: `Add a new backend to the storage.
|
|
|
|
Parameters to provide:
|
|
- id: Unique ID to represent the backend in the storage
|
|
- name: Human readable name to represent the backend. It will be used by
|
|
the user in the authentication page to select a backend during
|
|
authentication
|
|
- issuer: Full hostname of the OIDC provider, e.g. 'https://github.com'`,
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
fmt.Println("add called")
|
|
},
|
|
}
|
|
|
|
func init() {
|
|
backendCmd.AddCommand(backendAddCmd)
|
|
|
|
// Here you will define your flags and configuration settings.
|
|
|
|
// Cobra supports Persistent Flags which will work for this command
|
|
// and all subcommands, e.g.:
|
|
// backendAddCmd.PersistentFlags().String("foo", "", "A help for foo")
|
|
|
|
// Cobra supports local flags which will only run when this command
|
|
// is called directly, e.g.:
|
|
// backendAddCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
|
|
backendAddCmd.Flags().StringVarP(&backendID, "id", "i", "", "ID to identify the backend in the storage")
|
|
backendAddCmd.Flags().StringVarP(&backendName, "name", "n", "", "Name to represent the backend")
|
|
backendAddCmd.Flags().StringVarP(&backendIssuer, "issuer", "d", "", "Full hostname of the backend")
|
|
}
|