Skip to content
Snippets Groups Projects
Commit 5400a427 authored by Fabian Seidl's avatar Fabian Seidl Committed by Matthias Feyll
Browse files

Resolve "Change structure of user related requests in CLI to fit other schemes"

See merge request !953
parent 87478e3e
No related branches found
No related tags found
1 merge request!1005Draft: feature-ui-361_setup-project
......@@ -35,9 +35,7 @@ import (
"github.com/spf13/cobra"
)
//var duid string
// networkElementCmd represents the network element command.
// roleCmd represents the role command.
var roleCmd = &cobra.Command{
Use: "role",
Short: "the role command contains all sub-commands for role management",
......
/*
Copyright © 2021 da/net Research Group <danet@h-da.de>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
package cmd
import (
"github.com/spf13/cobra"
)
// userCmd represents the user command.
var userCmd = &cobra.Command{
Use: "user",
Short: "the user command contains all sub-commands for user management",
Long: `The user command contains all sub-commands for user management. It has no functionality in itself.`,
}
func init() {
rootCmd.AddCommand(userCmd)
}
......@@ -42,9 +42,9 @@ import (
"github.com/spf13/viper"
)
// loginCmd represents the login command.
// userCreateCmd represents the user creation command.
var userCreateCmd = &cobra.Command{
Use: "userCreate",
Use: "create",
Short: "Creates a user with provided data",
Long: `Creates a user with provided data.
User name and password hashed with (add hash method here!) required,
......@@ -82,7 +82,7 @@ var userCreateCmd = &cobra.Command{
var nbUserRole string
func init() {
rootCmd.AddCommand(userCreateCmd)
userCmd.AddCommand(userCreateCmd)
userCreateCmd.Flags().StringVar(&nbUserName, "u", "", "username for login")
userCreateCmd.Flags().StringVar(&nbUserPwd, "p", "", "pwd for login")
......
......@@ -41,9 +41,9 @@ import (
"github.com/spf13/viper"
)
// loginCmd represents the login command.
// userDeleteCmd represents the user delete command.
var userDeleteCmd = &cobra.Command{
Use: "userDelete",
Use: "delete",
Short: "Deletes a user with provided data",
Long: `Deletes a user with provided data.
Requires the user name of the user which should be deleted.`,
......@@ -68,7 +68,7 @@ var userDeleteCmd = &cobra.Command{
}
func init() {
rootCmd.AddCommand(userDeleteCmd)
userCmd.AddCommand(userDeleteCmd)
userDeleteCmd.Flags().StringVar(&nbUserName, "u", "", "username to delete")
}
......@@ -40,9 +40,9 @@ import (
"github.com/spf13/viper"
)
// loginCmd represents the login command.
// userGetCmd represents the get one user command.
var userGetCmd = &cobra.Command{
Use: "userGet",
Use: "get",
Short: "Requests one user",
Long: `Requests one user using the provided name to search for it in the stored users.`,
......@@ -71,7 +71,7 @@ var userGetCmd = &cobra.Command{
}
func init() {
rootCmd.AddCommand(userGetCmd)
userCmd.AddCommand(userGetCmd)
userGetCmd.Flags().StringVar(&nbUserName, "u", "", "username to find")
}
......@@ -39,9 +39,9 @@ import (
"github.com/spf13/viper"
)
// loginCmd represents the login command.
var userGetAllCmd = &cobra.Command{
Use: "userGetAll",
// userListCmd represents the get all users command.
var userListCmd = &cobra.Command{
Use: "list",
Short: "Requests all the available users",
Long: `Requests all the available users.`,
......@@ -62,5 +62,5 @@ var userGetAllCmd = &cobra.Command{
}
func init() {
rootCmd.AddCommand(userGetAllCmd)
userCmd.AddCommand(userListCmd)
}
......@@ -43,9 +43,9 @@ import (
"github.com/spf13/viper"
)
// loginCmd represents the login command.
// userUpdateCmd represents the update command.
var userUpdateCmd = &cobra.Command{
Use: "userUpdate",
Use: "update",
Short: "Updates a user with provided data",
Long: `Updates a user with provided data.
User name and password hashed with (add hash method here!) required,
......@@ -95,7 +95,7 @@ var userUpdateCmd = &cobra.Command{
var nbUserID string
func init() {
rootCmd.AddCommand(userUpdateCmd)
userCmd.AddCommand(userUpdateCmd)
userUpdateCmd.Flags().StringVar(&nbUserID, "i", "", "id of the user")
userUpdateCmd.Flags().StringVar(&nbUserName, "u", "", "username for login")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment