Move mmctl cpa subcommands under mmctl user attributes (#33975)

Co-authored-by: Miguel de la Cruz <miguel@ctrlz.es>
This commit is contained in:
Miguel de la Cruz
2025-09-29 13:29:30 +02:00
committed by GitHub
parent 9a61760bcb
commit a9b894b7c3
19 changed files with 130 additions and 131 deletions
@@ -16,31 +16,32 @@ import (
"github.com/spf13/cobra"
)
var CPACmd = &cobra.Command{
Use: "cpa",
Short: "Management of Custom Profile Attributes",
Long: "Management of Custom Profile Attributes (CPA) fields and values.",
var UserAttributesCmd = &cobra.Command{
Use: "attributes",
Aliases: []string{"attrs", "cpa"},
Short: "Management of User Attributes",
Long: "Management of User Attributes fields and values.",
}
var CPAFieldCmd = &cobra.Command{
var UserAttributesFieldCmd = &cobra.Command{
Use: "field",
Short: "Management of CPA fields",
Long: "Create, list, edit, and delete Custom Profile Attribute fields.",
Short: "Management of User Attributes fields",
Long: "Create, list, edit, and delete User Attribute fields.",
}
var CPAValueCmd = &cobra.Command{
var UserAttributesValueCmd = &cobra.Command{
Use: "value",
Short: "Management of CPA values",
Long: "List, set, and delete Custom Profile Attribute values for users.",
Short: "Management of User Attributes values",
Long: "List, set, and delete User Attribute values for users.",
}
func init() {
CPACmd.AddCommand(
CPAFieldCmd,
CPAValueCmd,
UserAttributesCmd.AddCommand(
UserAttributesFieldCmd,
UserAttributesValueCmd,
)
RootCmd.AddCommand(CPACmd)
UserCmd.AddCommand(UserAttributesCmd)
}
// Helper function to build field attributes from command flags
@@ -19,42 +19,41 @@ import (
var CPAFieldListCmd = &cobra.Command{
Use: "list",
Short: "List CPA fields",
Long: "List all Custom Profile Attribute fields with their properties.",
Example: ` cpa field list`,
Short: "List User Attributes fields",
Long: "List all User Attributes fields with their properties.",
Example: ` user attributes field list`,
Args: cobra.NoArgs,
RunE: withClient(cpaFieldListCmdF),
}
var CPAFieldCreateCmd = &cobra.Command{
Use: "create [name] [type]",
Short: "Create a CPA field",
Long: `Create a new Custom Profile Attribute field with the specified name and type.`,
Example: ` cpa field create "Department" text --managed
cpa field create "Skills" multiselect --option Go --option React --option Python
cpa field create "Level" select --attrs '{"visibility":"always"}'`,
Short: "Create a User Attributes field",
Long: `Create a new User Attributes field with the specified name and type.`,
Example: ` user attributes field create "Department" text --managed
user attributes field create "Skills" multiselect --option Go --option React --option Python
user attributes field create "Level" select --attrs '{"visibility":"always"}'`,
Args: cobra.ExactArgs(2),
RunE: withClient(cpaFieldCreateCmdF),
}
var CPAFieldEditCmd = &cobra.Command{
Use: "edit [field]",
Short: "Edit a CPA field",
Long: "Edit an existing Custom Profile Attribute field by ID or name.",
Example: ` cpa field edit n4qdbtro4j8x3n8z81p48ww9gr --name "Department Name" --managed
cpa field edit Department --option Go --option React --option Python --option Java
cpa field edit Skills --managed=false`,
Short: "Edit a User Attributes field",
Long: "Edit an existing User Attributes field.",
Example: ` user attributes field edit n4qdbtro4j8x3n8z81p48ww9gr --name "Department Name" --managed
user attributes field edit Department --option Go --option React --option Python --option Java
user attributes field edit Skills --managed=false`,
Args: cobra.ExactArgs(1),
RunE: withClient(cpaFieldEditCmdF),
}
var CPAFieldDeleteCmd = &cobra.Command{
Use: "delete [field]",
Short: "Delete a CPA field",
Long: "Delete a Custom Profile Attribute field by ID or name. This will automatically delete all user values for this field.",
Example: ` cpa field delete n4qdbtro4j8x3n8z81p48ww9gr --confirm
cpa field delete Department --confirm
cpa field delete Skills --confirm`,
Short: "Delete a User Attributes field",
Long: "Delete a User Attributes field. This will automatically delete all user values for this field.",
Example: ` user attributes field delete n4qdbtro4j8x3n8z81p48ww9gr --confirm
user attributes field delete Department --confirm`,
Args: cobra.ExactArgs(1),
RunE: withClient(cpaFieldDeleteCmdF),
}
@@ -74,8 +73,8 @@ func init() {
// Delete flags
CPAFieldDeleteCmd.Flags().Bool("confirm", false, "Bypass confirmation prompt")
// Add subcommands to CPAFieldCmd
CPAFieldCmd.AddCommand(
// Add subcommands to UserAttributesFieldCmd
UserAttributesFieldCmd.AddCommand(
CPAFieldListCmd,
CPAFieldCreateCmd,
CPAFieldEditCmd,
@@ -18,21 +18,21 @@ import (
var CPAValueListCmd = &cobra.Command{
Use: "list [user]",
Short: "List CPA values for a user",
Long: "List all Custom Profile Attribute values for a specific user.",
Example: ` cpa value list john.doe@company.com
cpa value list johndoe`,
Short: "List User Attributes values for a user",
Long: "List all User Attributes values for a specific user.",
Example: ` user attributes value list john.doe@company.com
user attributes value list johndoe`,
Args: cobra.ExactArgs(1),
RunE: withClient(cpaValueListCmdF),
}
var CPAValueSetCmd = &cobra.Command{
Use: "set [user] [field]",
Short: "Set a CPA value for a user",
Long: "Set a Custom Profile Attribute field value for a specific user by field ID or name.",
Example: ` cpa value set john.doe@company.com kx8m2w4r9p3q7n5t1j6h8s4c9e --value Engineering
cpa value set johndoe Department --value Engineering
cpa value set user123 Skills --value Go --value React --value Python`,
Short: "Set a User Attributes value for a user",
Long: "Set a User Attributes field value for a specific user.",
Example: ` user attributes value set john.doe@company.com kx8m2w4r9p3q7n5t1j6h8s4c9e --value "Engineering"
user attributes value set johndoe Department --value "Go" --value "React" --value "Python"
user attributes value set user123 Skills --value "Senior"`,
Args: cobra.ExactArgs(2),
RunE: withClient(cpaValueSetCmdF),
}
@@ -42,8 +42,8 @@ func init() {
CPAValueSetCmd.Flags().StringSlice("value", []string{}, "Value(s) to set for the field. Can be specified multiple times for multiselect/multiuser fields")
_ = CPAValueSetCmd.MarkFlagRequired("value")
// Add subcommands to CPAValueCmd
CPAValueCmd.AddCommand(
// Add subcommands to UserAttributesValueCmd
UserAttributesValueCmd.AddCommand(
CPAValueListCmd,
CPAValueSetCmd,
)
-1
View File
@@ -37,7 +37,6 @@ SEE ALSO
* `mmctl completion <mmctl_completion.rst>`_ - Generate the autocompletion script for the specified shell
* `mmctl compliance-export <mmctl_compliance-export.rst>`_ - Management of compliance exports
* `mmctl config <mmctl_config.rst>`_ - Configuration
* `mmctl cpa <mmctl_cpa.rst>`_ - Management of Custom Profile Attributes
* `mmctl docs <mmctl_docs.rst>`_ - Generates mmctl documentation
* `mmctl export <mmctl_export.rst>`_ - Management of exports
* `mmctl extract <mmctl_extract.rst>`_ - Management of content extraction job.
+1
View File
@@ -38,6 +38,7 @@ SEE ALSO
* `mmctl <mmctl.rst>`_ - Remote client for the Open Source, self-hosted Slack-alternative
* `mmctl user activate <mmctl_user_activate.rst>`_ - Activate users
* `mmctl user attributes <mmctl_user_attributes.rst>`_ - Management of User Attributes
* `mmctl user change-password <mmctl_user_change-password.rst>`_ - Changes a user's password
* `mmctl user convert <mmctl_user_convert.rst>`_ - Convert users to bots, or a bot to a user
* `mmctl user create <mmctl_user_create.rst>`_ - Create a user
@@ -1,22 +1,22 @@
.. _mmctl_cpa_value:
.. _mmctl_user_attributes:
mmctl cpa value
---------------
mmctl user attributes
---------------------
Management of CPA values
Management of User Attributes
Synopsis
~~~~~~~~
List, set, and delete Custom Profile Attribute values for users.
Management of User Attributes fields and values.
Options
~~~~~~~
::
-h, --help help for value
-h, --help help for attributes
Options inherited from parent commands
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -36,7 +36,7 @@ Options inherited from parent commands
SEE ALSO
~~~~~~~~
* `mmctl cpa <mmctl_cpa.rst>`_ - Management of Custom Profile Attributes
* `mmctl cpa value list <mmctl_cpa_value_list.rst>`_ - List CPA values for a user
* `mmctl cpa value set <mmctl_cpa_value_set.rst>`_ - Set a CPA value for a user
* `mmctl user <mmctl_user.rst>`_ - Management of users
* `mmctl user attributes field <mmctl_user_attributes_field.rst>`_ - Management of User Attributes fields
* `mmctl user attributes value <mmctl_user_attributes_value.rst>`_ - Management of User Attributes values
@@ -1,15 +1,15 @@
.. _mmctl_cpa_field:
.. _mmctl_user_attributes_field:
mmctl cpa field
---------------
mmctl user attributes field
---------------------------
Management of CPA fields
Management of User Attributes fields
Synopsis
~~~~~~~~
Create, list, edit, and delete Custom Profile Attribute fields.
Create, list, edit, and delete User Attribute fields.
Options
~~~~~~~
@@ -36,9 +36,9 @@ Options inherited from parent commands
SEE ALSO
~~~~~~~~
* `mmctl cpa <mmctl_cpa.rst>`_ - Management of Custom Profile Attributes
* `mmctl cpa field create <mmctl_cpa_field_create.rst>`_ - Create a CPA field
* `mmctl cpa field delete <mmctl_cpa_field_delete.rst>`_ - Delete a CPA field
* `mmctl cpa field edit <mmctl_cpa_field_edit.rst>`_ - Edit a CPA field
* `mmctl cpa field list <mmctl_cpa_field_list.rst>`_ - List CPA fields
* `mmctl user attributes <mmctl_user_attributes.rst>`_ - Management of User Attributes
* `mmctl user attributes field create <mmctl_user_attributes_field_create.rst>`_ - Create a User Attributes field
* `mmctl user attributes field delete <mmctl_user_attributes_field_delete.rst>`_ - Delete a User Attributes field
* `mmctl user attributes field edit <mmctl_user_attributes_field_edit.rst>`_ - Edit a User Attributes field
* `mmctl user attributes field list <mmctl_user_attributes_field_list.rst>`_ - List User Attributes fields
@@ -1,28 +1,28 @@
.. _mmctl_cpa_field_create:
.. _mmctl_user_attributes_field_create:
mmctl cpa field create
----------------------
mmctl user attributes field create
----------------------------------
Create a CPA field
Create a User Attributes field
Synopsis
~~~~~~~~
Create a new Custom Profile Attribute field with the specified name and type.
Create a new User Attributes field with the specified name and type.
::
mmctl cpa field create [name] [type] [flags]
mmctl user attributes field create [name] [type] [flags]
Examples
~~~~~~~~
::
cpa field create "Department" text --managed
cpa field create "Skills" multiselect --option Go --option React --option Python
cpa field create "Level" select --attrs '{"visibility":"always"}'
user attributes field create "Department" text --managed
user attributes field create "Skills" multiselect --option Go --option React --option Python
user attributes field create "Level" select --attrs '{"visibility":"always"}'
Options
~~~~~~~
@@ -52,5 +52,5 @@ Options inherited from parent commands
SEE ALSO
~~~~~~~~
* `mmctl cpa field <mmctl_cpa_field.rst>`_ - Management of CPA fields
* `mmctl user attributes field <mmctl_user_attributes_field.rst>`_ - Management of User Attributes fields
@@ -1,28 +1,27 @@
.. _mmctl_cpa_field_delete:
.. _mmctl_user_attributes_field_delete:
mmctl cpa field delete
----------------------
mmctl user attributes field delete
----------------------------------
Delete a CPA field
Delete a User Attributes field
Synopsis
~~~~~~~~
Delete a Custom Profile Attribute field by ID or name. This will automatically delete all user values for this field.
Delete a User Attributes field. This will automatically delete all user values for this field.
::
mmctl cpa field delete [field] [flags]
mmctl user attributes field delete [field] [flags]
Examples
~~~~~~~~
::
cpa field delete n4qdbtro4j8x3n8z81p48ww9gr --confirm
cpa field delete Department --confirm
cpa field delete Skills --confirm
user attributes field delete n4qdbtro4j8x3n8z81p48ww9gr --confirm
user attributes field delete Department --confirm
Options
~~~~~~~
@@ -50,5 +49,5 @@ Options inherited from parent commands
SEE ALSO
~~~~~~~~
* `mmctl cpa field <mmctl_cpa_field.rst>`_ - Management of CPA fields
* `mmctl user attributes field <mmctl_user_attributes_field.rst>`_ - Management of User Attributes fields
@@ -1,28 +1,28 @@
.. _mmctl_cpa_field_edit:
.. _mmctl_user_attributes_field_edit:
mmctl cpa field edit
--------------------
mmctl user attributes field edit
--------------------------------
Edit a CPA field
Edit a User Attributes field
Synopsis
~~~~~~~~
Edit an existing Custom Profile Attribute field by ID or name.
Edit an existing User Attributes field.
::
mmctl cpa field edit [field] [flags]
mmctl user attributes field edit [field] [flags]
Examples
~~~~~~~~
::
cpa field edit n4qdbtro4j8x3n8z81p48ww9gr --name "Department Name" --managed
cpa field edit Department --option Go --option React --option Python --option Java
cpa field edit Skills --managed=false
user attributes field edit n4qdbtro4j8x3n8z81p48ww9gr --name "Department Name" --managed
user attributes field edit Department --option Go --option React --option Python --option Java
user attributes field edit Skills --managed=false
Options
~~~~~~~
@@ -53,5 +53,5 @@ Options inherited from parent commands
SEE ALSO
~~~~~~~~
* `mmctl cpa field <mmctl_cpa_field.rst>`_ - Management of CPA fields
* `mmctl user attributes field <mmctl_user_attributes_field.rst>`_ - Management of User Attributes fields
@@ -1,26 +1,26 @@
.. _mmctl_cpa_field_list:
.. _mmctl_user_attributes_field_list:
mmctl cpa field list
--------------------
mmctl user attributes field list
--------------------------------
List CPA fields
List User Attributes fields
Synopsis
~~~~~~~~
List all Custom Profile Attribute fields with their properties.
List all User Attributes fields with their properties.
::
mmctl cpa field list [flags]
mmctl user attributes field list [flags]
Examples
~~~~~~~~
::
cpa field list
user attributes field list
Options
~~~~~~~
@@ -47,5 +47,5 @@ Options inherited from parent commands
SEE ALSO
~~~~~~~~
* `mmctl cpa field <mmctl_cpa_field.rst>`_ - Management of CPA fields
* `mmctl user attributes field <mmctl_user_attributes_field.rst>`_ - Management of User Attributes fields
@@ -1,22 +1,22 @@
.. _mmctl_cpa:
.. _mmctl_user_attributes_value:
mmctl cpa
---------
mmctl user attributes value
---------------------------
Management of Custom Profile Attributes
Management of User Attributes values
Synopsis
~~~~~~~~
Management of Custom Profile Attributes (CPA) fields and values.
List, set, and delete User Attribute values for users.
Options
~~~~~~~
::
-h, --help help for cpa
-h, --help help for value
Options inherited from parent commands
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -36,7 +36,7 @@ Options inherited from parent commands
SEE ALSO
~~~~~~~~
* `mmctl <mmctl.rst>`_ - Remote client for the Open Source, self-hosted Slack-alternative
* `mmctl cpa field <mmctl_cpa_field.rst>`_ - Management of CPA fields
* `mmctl cpa value <mmctl_cpa_value.rst>`_ - Management of CPA values
* `mmctl user attributes <mmctl_user_attributes.rst>`_ - Management of User Attributes
* `mmctl user attributes value list <mmctl_user_attributes_value_list.rst>`_ - List User Attributes values for a user
* `mmctl user attributes value set <mmctl_user_attributes_value_set.rst>`_ - Set a User Attributes value for a user
@@ -1,27 +1,27 @@
.. _mmctl_cpa_value_list:
.. _mmctl_user_attributes_value_list:
mmctl cpa value list
--------------------
mmctl user attributes value list
--------------------------------
List CPA values for a user
List User Attributes values for a user
Synopsis
~~~~~~~~
List all Custom Profile Attribute values for a specific user.
List all User Attributes values for a specific user.
::
mmctl cpa value list [user] [flags]
mmctl user attributes value list [user] [flags]
Examples
~~~~~~~~
::
cpa value list john.doe@company.com
cpa value list johndoe
user attributes value list john.doe@company.com
user attributes value list johndoe
Options
~~~~~~~
@@ -48,5 +48,5 @@ Options inherited from parent commands
SEE ALSO
~~~~~~~~
* `mmctl cpa value <mmctl_cpa_value.rst>`_ - Management of CPA values
* `mmctl user attributes value <mmctl_user_attributes_value.rst>`_ - Management of User Attributes values
@@ -1,28 +1,28 @@
.. _mmctl_cpa_value_set:
.. _mmctl_user_attributes_value_set:
mmctl cpa value set
-------------------
mmctl user attributes value set
-------------------------------
Set a CPA value for a user
Set a User Attributes value for a user
Synopsis
~~~~~~~~
Set a Custom Profile Attribute field value for a specific user by field ID or name.
Set a User Attributes field value for a specific user.
::
mmctl cpa value set [user] [field] [flags]
mmctl user attributes value set [user] [field] [flags]
Examples
~~~~~~~~
::
cpa value set john.doe@company.com kx8m2w4r9p3q7n5t1j6h8s4c9e --value Engineering
cpa value set johndoe Department --value Engineering
cpa value set user123 Skills --value Go --value React --value Python
user attributes value set john.doe@company.com kx8m2w4r9p3q7n5t1j6h8s4c9e --value "Engineering"
user attributes value set johndoe Department --value "Go" --value "React" --value "Python"
user attributes value set user123 Skills --value "Senior"
Options
~~~~~~~
@@ -50,5 +50,5 @@ Options inherited from parent commands
SEE ALSO
~~~~~~~~
* `mmctl cpa value <mmctl_cpa_value.rst>`_ - Management of CPA values
* `mmctl user attributes value <mmctl_user_attributes_value.rst>`_ - Management of User Attributes values