diff --git a/cli/cmd/role.go b/cli/cmd/role.go index 5e587e05c72fe6e5c730090914dff3217f5b0fb4..11e5a670b778adc7ffdc0431959f1000d9f537e1 100644 --- a/cli/cmd/role.go +++ b/cli/cmd/role.go @@ -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", diff --git a/cli/cmd/user.go b/cli/cmd/user.go new file mode 100644 index 0000000000000000000000000000000000000000..dcae6eabacfaa16166feec8f79123e08267954bf --- /dev/null +++ b/cli/cmd/user.go @@ -0,0 +1,47 @@ +/* +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) +} diff --git a/cli/cmd/userCreate.go b/cli/cmd/userCreate.go index cdadaba9430dcc1c8108aacfe26edf01e4512b40..c8cb3c12e54fc4b98687846dac3ad26920046b7a 100644 --- a/cli/cmd/userCreate.go +++ b/cli/cmd/userCreate.go @@ -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") diff --git a/cli/cmd/userDelete.go b/cli/cmd/userDelete.go index 22339c3589b9d82f59e1ea426db8b4e6fc0c6a7d..3638429d356859d019b4c2209e2cac7b566077c1 100644 --- a/cli/cmd/userDelete.go +++ b/cli/cmd/userDelete.go @@ -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") } diff --git a/cli/cmd/userGet.go b/cli/cmd/userGet.go index 357966913129735b7c630689224ac698b96bf017..fa38558ecb7f84e0781471051b78750816a4c439 100644 --- a/cli/cmd/userGet.go +++ b/cli/cmd/userGet.go @@ -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") } diff --git a/cli/cmd/userGetAll.go b/cli/cmd/userGetAll.go index 8a5c650f0a1a396cfad9d8f2d7fd272149841f1f..f033708a95d0dcc54a01eb0d908175721e68268a 100644 --- a/cli/cmd/userGetAll.go +++ b/cli/cmd/userGetAll.go @@ -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) } diff --git a/cli/cmd/userUpdate.go b/cli/cmd/userUpdate.go index 17a68cf8c0a43d2e62f4e0f7e2e1907417a0c6de..8335070cac72a9afdd501be895e0b1ce4a262199 100644 --- a/cli/cmd/userUpdate.go +++ b/cli/cmd/userUpdate.go @@ -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")