commands

package
v0.0.0-...-1bb2fec Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 21, 2021 License: Apache-2.0 Imports: 42 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MethodPassword = "P"
	MethodToken    = "T"
	MethodMFA      = "M"
)
View Source
const APILimitMaximum = 200

Variables

View Source
var AddChannelUsersCmd = &cobra.Command{
	Use:        "add [channel] [users]",
	Short:      "Add users to channel",
	Long:       "Add some users to channel",
	Example:    "  channel add myteam:mychannel user@example.com username",
	Deprecated: "please use \"users add\" instead",
	RunE:       withClient(channelUsersAddCmdF),
}
View Source
var AddPermissionsCmd = &cobra.Command{
	Use:   "add <role> <permission...>",
	Short: "Add permissions to a role (EE Only)",
	Long:  `Add one or more permissions to an existing role (Only works in Enterprise Edition).`,
	Example: `  permissions add system_user list_open_teams
  permissions add system_manager sysconsole_read_user_management_channels`,
	Args: cobra.MinimumNArgs(2),
	RunE: withClient(addPermissionsCmdF),
}
View Source
var ArchiveChannelsCmd = &cobra.Command{
	Use:   "archive [channels]",
	Short: "Archive channels",
	Long: `Archive some channels.
Archive a channel along with all related information including posts from the database.
Channels can be specified by [team]:[channel]. ie. myteam:mychannel or by channel ID.`,
	Example: "  channel archive myteam:mychannel",
	RunE:    withClient(archiveChannelsCmdF),
}
View Source
var ArchiveTeamsCmd = &cobra.Command{
	Use:   "archive [teams]",
	Short: "Archive teams",
	Long: `Archive some teams.
Archives a team along with all related information including posts from the database.`,
	Example: "  team archive myteam",
	Args:    cobra.MinimumNArgs(1),
	RunE:    withClient(archiveTeamsCmdF),
}
View Source
var AssignBotCmd = &cobra.Command{
	Use:     "assign [bot-username] [new-owner-username]",
	Short:   "Assign bot",
	Long:    "Assign the ownership of a bot to another user",
	Example: `  bot assign testbot user2`,
	RunE:    withClient(botAssignCmdF),
	Args:    cobra.ExactArgs(2),
}
View Source
var AssignCmd = &cobra.Command{
	Use:   "assign <role_name> <username...>",
	Short: "Assign users to role (EE Only)",
	Long:  "Assign users to a role by username (Only works in Enterprise Edition).",
	Example: `  # Assign users with usernames 'john.doe' and 'jane.doe' to the role named 'system_admin'.
  permissions assign system_admin john.doe jane.doe
  
  # Examples using other system roles
  permissions assign system_manager john.doe jane.doe
  permissions assign system_user_manager john.doe jane.doe
  permissions assign system_read_only_admin john.doe jane.doe`,
	Args: cobra.MinimumNArgs(2),
	RunE: withClient(assignUsersCmdF),
}
View Source
var AuthCmd = &cobra.Command{
	Use:   "auth",
	Short: "Manages the credentials of the remote Mattermost instances",
}
View Source
var BashCmd = &cobra.Command{
	Use:   "bash",
	Short: "Generates the bash autocompletion scripts",
	Long: `To load completion, run

. <(mmctl completion bash)

To configure your bash shell to load completions for each session, add the above line to your ~/.bashrc
`,
	RunE: bashCmdF,
}
View Source
var BotCmd = &cobra.Command{
	Use:   "bot",
	Short: "Management of bots",
}
View Source
var ChangePasswordUserCmd = &cobra.Command{
	Use:   "change-password <user>",
	Short: "Changes a user's password",
	Long:  "Changes the password of a user by a new one provided. If the user is changing their own password, the flag --current must indicate the current password. The flag --hashed can be used to indicate that the new password has been introduced already hashed",
	Example: `  # if you have system permissions, you can change other user's passwords
  $ mmctl user change-password john_doe --password new-password

  # if you are changing your own password, you need to provide the current one
  $ mmctl user change-password my-username --current current-password --password new-password

  # you can ommit these flags to introduce them interactively
  $ mmctl user change-password my-username
  Are you changing your own password? (YES/NO): YES
  Current password:
  New password:

  # if you have system permissions, you can update the password with the already hashed new
  # password. The hashing method should be the same that the server uses internally
  $ mmctl user change-password john_doe --password HASHED_PASSWORD --hashed`,
	Args: cobra.ExactArgs(1),
	RunE: withClient(changePasswordUserCmdF),
}
View Source
var ChannelCmd = &cobra.Command{
	Use:   "channel",
	Short: "Management of channels",
}
View Source
var ChannelCreateCmd = &cobra.Command{
	Use:   "create",
	Short: "Create a channel",
	Long:  `Create a channel.`,
	Example: `  channel create --team myteam --name mynewchannel --display-name "My New Channel"
  channel create --team myteam --name mynewprivatechannel --display-name "My New Private Channel" --private`,
	RunE: withClient(createChannelCmdF),
}
View Source
var ChannelGroupCmd = &cobra.Command{
	Use:   "channel",
	Short: "Management of channel groups",
}
View Source
var ChannelGroupDisableCmd = &cobra.Command{
	Use:     "disable [team]:[channel]",
	Short:   "Disables group constrains in the specified channel",
	Example: "  group channel disable myteam:mychannel",
	Args:    cobra.ExactArgs(1),
	RunE:    withClient(channelGroupDisableCmdF),
}
View Source
var ChannelGroupEnableCmd = &cobra.Command{
	Use:     "enable [team]:[channel]",
	Short:   "Enables group constrains in the specified channel",
	Example: "  group channel enable myteam:mychannel",
	Args:    cobra.ExactArgs(1),
	RunE:    withClient(channelGroupEnableCmdF),
}
View Source
var ChannelGroupListCmd = &cobra.Command{
	Use:     "list [team]:[channel]",
	Short:   "List channel groups",
	Long:    "List the groups associated with a channel",
	Example: "  group channel list myteam:mychannel",
	Args:    cobra.ExactArgs(1),
	RunE:    withClient(channelGroupListCmdF),
}
View Source
var ChannelGroupStatusCmd = &cobra.Command{
	Use:     "status [team]:[channel]",
	Short:   "Show's the group constrain status for the specified channel",
	Example: "  group channel status myteam:mychannel",
	Args:    cobra.ExactArgs(1),
	RunE:    withClient(channelGroupStatusCmdF),
}

ChannelGroupStatusCmd is a command which outputs group constrain status for a channel

View Source
var ChannelRenameCmd = &cobra.Command{
	Use:   "rename [channel]",
	Short: "Rename channel",
	Long:  `Rename an existing channel.`,
	Example: `  channel rename myteam:oldchannel --name 'new-channel' --display-name 'New Display Name'
  channel rename myteam:oldchannel --name 'new-channel'
  channel rename myteam:oldchannel --display-name 'New Display Name'`,
	Args: cobra.ExactArgs(1),
	RunE: withClient(renameChannelCmdF),
}

ChannelRenameCmd is used to change name and/or display name of an existing channel.

View Source
var ChannelUsersAddCmd = &cobra.Command{
	Use:     "add [channel] [users]",
	Short:   "Add users to channel",
	Long:    "Add some users to channel",
	Example: "  channel users add myteam:mychannel user@example.com username",
	RunE:    withClient(channelUsersAddCmdF),
}
View Source
var ChannelUsersCmd = &cobra.Command{
	Use:   "users",
	Short: "Management of channel users",
}
View Source
var ChannelUsersRemoveCmd = &cobra.Command{
	Use:   "remove [channel] [users]",
	Short: "Remove users from channel",
	Long:  "Remove some users from channel",
	Example: `  channel users remove myteam:mychannel user@example.com username
  channel users remove myteam:mychannel --all-users`,
	RunE: withClient(channelUsersRemoveCmdF),
}
View Source
var CleanCmd = &cobra.Command{
	Use:     "clean",
	Short:   "Clean all credentials",
	Long:    "Clean the currently stored credentials",
	Example: `  auth clean`,
	RunE:    cleanCmdF,
}
View Source
var CommandArchiveCmd = &cobra.Command{
	Use:     "archive [commandID]",
	Short:   "Archive a slash command",
	Long:    `Archive a slash command. Commands can be specified by command ID.`,
	Example: `  command archive commandID`,
	Args:    cobra.ExactArgs(1),
	RunE:    withClient(archiveCommandCmdF),
}
View Source
var CommandCmd = &cobra.Command{
	Use:   "command",
	Short: "Management of slash commands",
}
View Source
var CommandCreateCmd = &cobra.Command{
	Use:     "create [team]",
	Short:   "Create a custom slash command",
	Long:    `Create a custom slash command for the specified team.`,
	Args:    cobra.MinimumNArgs(1),
	Example: `  command create myteam --title MyCommand --description "My Command Description" --trigger-word mycommand --url http://localhost:8000/my-slash-handler --creator myusername --response-username my-bot-username --icon http://localhost:8000/my-slash-handler-bot-icon.png --autocomplete --post`,
	RunE:    withClient(createCommandCmdF),
}
View Source
var CommandDeleteCmd = &cobra.Command{
	Use:        "delete [commandID]",
	Short:      "Delete a slash command",
	Long:       `Delete a slash command. Commands can be specified by command ID.`,
	Example:    `  command delete commandID`,
	Deprecated: "please use \"archive\" instead",
	Args:       cobra.ExactArgs(1),
	RunE:       withClient(archiveCommandCmdF),
}
View Source
var CommandListCmd = &cobra.Command{
	Use:     "list [teams]",
	Short:   "List all commands on specified teams.",
	Long:    `List all commands on specified teams.`,
	Example: ` command list myteam`,
	RunE:    withClient(listCommandCmdF),
}
View Source
var CommandModifyCmd = &cobra.Command{
	Use:     "modify [commandID]",
	Short:   "Modify a slash command",
	Long:    `Modify a slash command. Commands can be specified by command ID.`,
	Args:    cobra.ExactArgs(1),
	Example: `  command modify commandID --title MyModifiedCommand --description "My Modified Command Description" --trigger-word mycommand --url http://localhost:8000/my-slash-handler --creator myusername --response-username my-bot-username --icon http://localhost:8000/my-slash-handler-bot-icon.png --autocomplete --post`,
	RunE:    withClient(modifyCommandCmdF),
}
View Source
var CommandMoveCmd = &cobra.Command{
	Use:     "move [team] [commandID]",
	Short:   "Move a slash command to a different team",
	Long:    `Move a slash command to a different team. Commands can be specified by command ID.`,
	Args:    cobra.ExactArgs(2),
	Example: `  command move newteam commandID`,
	RunE:    withClient(moveCommandCmdF),
}
View Source
var CommandShowCmd = &cobra.Command{
	Use:     "show [commandID]",
	Short:   "Show a custom slash command",
	Long:    `Show a custom slash command. Commands can be specified by command ID. Returns command ID, team ID, trigger word, display name and creator username.`,
	Args:    cobra.ExactArgs(1),
	Example: `  command show commandID`,
	RunE:    withClient(showCommandCmdF),
}
View Source
var CompletionCmd = &cobra.Command{
	Use:   "completion",
	Short: "Generates autocompletion scripts for bash and zsh",
}
View Source
var ConfigCmd = &cobra.Command{
	Use:   "config",
	Short: "Configuration",
}
View Source
var ConfigEditCmd = &cobra.Command{
	Use:     "edit",
	Short:   "Edit the config",
	Long:    "Opens the editor defined in the EDITOR environment variable to modify the server's configuration and then uploads it",
	Example: "config edit",
	Args:    cobra.NoArgs,
	RunE:    withClient(configEditCmdF),
}
View Source
var ConfigGetCmd = &cobra.Command{
	Use:     "get",
	Short:   "Get config setting",
	Long:    "Gets the value of a config setting by its name in dot notation.",
	Example: `config get SqlSettings.DriverName`,
	Args:    cobra.ExactArgs(1),
	RunE:    withClient(configGetCmdF),
}
View Source
var ConfigMigrateCmd = &cobra.Command{
	Use:     "migrate [from_config] [to_config]",
	Short:   "Migrate existing config between backends",
	Long:    "Migrate a file-based configuration to (or from) a database-based configuration. Point the Mattermost server at the target configuration to start using it",
	Example: `config migrate path/to/config.json "postgres://mmuser:mostest@localhost:5432/mattermost_test?sslmode=disable&connect_timeout=10"`,
	Args:    cobra.ExactArgs(2),
	RunE:    withClient(configMigrateCmdF),
}
View Source
var ConfigPatchCmd = &cobra.Command{
	Use:     "patch <config-file>",
	Short:   "Patch the config",
	Long:    "Patches config settings with the given config file.",
	Example: "config patch /path/to/config.json",
	Args:    cobra.ExactArgs(1),
	RunE:    withClient(configPatchCmdF),
}
View Source
var ConfigReloadCmd = &cobra.Command{
	Use:     "reload",
	Short:   "Reload the server configuration",
	Long:    "Reload the server configuration in case you want to new settings to be applied.",
	Example: "config reload",
	Args:    cobra.NoArgs,
	RunE:    withClient(configReloadCmdF),
}
View Source
var ConfigResetCmd = &cobra.Command{
	Use:     "reset",
	Short:   "Reset config setting",
	Long:    "Resets the value of a config setting by its name in dot notation or a setting section. Accepts multiple values for array settings.",
	Example: "config reset SqlSettings.DriverName LogSettings",
	Args:    cobra.MinimumNArgs(1),
	RunE:    withClient(configResetCmdF),
}
View Source
var ConfigSetCmd = &cobra.Command{
	Use:     "set",
	Short:   "Set config setting",
	Long:    "Sets the value of a config setting by its name in dot notation. Accepts multiple values for array settings",
	Example: "config set SqlSettings.DriverName mysql\nconfig set SqlSettings.DataSourceReplicas \"replica1\" \"replica2\"",
	Args:    cobra.MinimumNArgs(2),
	RunE:    withClient(configSetCmdF),
}
View Source
var ConfigShowCmd = &cobra.Command{
	Use:     "show",
	Short:   "Writes the server configuration to STDOUT",
	Long:    "Prints the server configuration and writes to STDOUT in JSON format.",
	Example: "config show",
	Args:    cobra.NoArgs,
	RunE:    withClient(configShowCmdF),
}
View Source
var ConfigSubpathCmd = &cobra.Command{
	Use:   "subpath",
	Short: "Update client asset loading to use the configured subpath",
	Long:  "Update the hard-coded production client asset paths to take into account Mattermost running on a subpath. This command needs access to the Mattermost assets directory to be able to rewrite the paths.",
	Example: `  # you can rewrite the assets to use a subpath
  mmctl config subpath --assets-dir /opt/mattermost/client --path /mattermost

  # the subpath can have multiple steps
  mmctl config subpath --assets-dir /opt/mattermost/client --path /my/custom/subpath

  # or you can fallback to the root path passing /
  mmctl config subpath --assets-dir /opt/mattermost/client --path /`,
	Args: cobra.NoArgs,
	RunE: configSubpathCmdF,
}
View Source
var CreateBotCmd = &cobra.Command{
	Use:     "create [username]",
	Short:   "Create bot",
	Long:    "Create bot.",
	Example: `  bot create testbot`,
	PreRun:  disableLocalPrecheck,
	RunE:    withClient(botCreateCmdF),
	Args:    cobra.ExactArgs(1),
}
View Source
var CreateIncomingWebhookCmd = &cobra.Command{
	Use:     "create-incoming",
	Short:   "Create incoming webhook",
	Long:    "create incoming webhook which allows external posting of messages to specific channel",
	Example: "  webhook create-incoming --channel [channelID] --user [userID] --display-name [displayName] --description [webhookDescription] --lock-to-channel --icon [iconURL]",
	RunE:    withClient(createIncomingWebhookCmdF),
}
View Source
var CreateOutgoingWebhookCmd = &cobra.Command{
	Use:   "create-outgoing",
	Short: "Create outgoing webhook",
	Long:  "create outgoing webhook which allows external posting of messages from a specific channel",
	Example: `  webhook create-outgoing --team myteam --user myusername --display-name mywebhook --trigger-word "build" --trigger-word "test" --url http://localhost:8000/my-webhook-handler
	webhook create-outgoing --team myteam --channel mychannel --user myusername --display-name mywebhook --description "My cool webhook" --trigger-when start --trigger-word build --trigger-word test --icon http://localhost:8000/my-slash-handler-bot-icon.png --url http://localhost:8000/my-webhook-handler --content-type "application/json"`,
	RunE: withClient(createOutgoingWebhookCmdF),
}
View Source
var CurrentCmd = &cobra.Command{
	Use:     "current",
	Short:   "Show current user credentials",
	Long:    "Show the currently stored user credentials",
	Example: `  auth current`,
	RunE:    currentCmdF,
}
View Source
var DeleteAllUsersCmd = &cobra.Command{
	Use:     "deleteall",
	Short:   "Delete all users and all posts. Local command only.",
	Long:    "Permanently delete all users and all related information including posts. This command can only be run in local mode.",
	Example: "  user deleteall",
	Args:    cobra.NoArgs,
	PreRun:  localOnlyPrecheck,
	RunE:    withClient(deleteAllUsersCmdF),
}
View Source
var DeleteChannelsCmd = &cobra.Command{
	Use:   "delete [channels]",
	Short: "Delete channels",
	Long: `Permanently delete some channels.
Permanently deletes one or multiple channels along with all related information including posts from the database.`,
	Example: "  channel delete myteam:mychannel",
	Args:    cobra.MinimumNArgs(1),
	RunE:    withClient(deleteChannelsCmdF),
}
View Source
var DeleteCmd = &cobra.Command{
	Use:     "delete [server name]",
	Short:   "Delete an credentials",
	Long:    "Delete an credentials by its name",
	Example: `  auth delete local-server`,
	Args:    cobra.ExactArgs(1),
	RunE:    deleteCmdF,
}
View Source
var DeleteTeamsCmd = &cobra.Command{
	Use:   "delete [teams]",
	Short: "Delete teams",
	Long: `Permanently delete some teams.
Permanently deletes a team along with all related information including posts from the database.`,
	Example: "  team delete myteam",
	Args:    cobra.MinimumNArgs(1),
	RunE:    withClient(deleteTeamsCmdF),
}
View Source
var DeleteUsersCmd = &cobra.Command{
	Use:   "delete [users]",
	Short: "Delete users",
	Long: `Permanently delete some users.
Permanently deletes one or multiple users along with all related information including posts from the database.`,
	Example: "  user delete user@example.com",
	Args:    cobra.MinimumNArgs(1),
	RunE:    withClient(deleteUsersCmdF),
}
View Source
var DeleteWebhookCmd = &cobra.Command{
	Use:     "delete",
	Short:   "Delete webhooks",
	Long:    "Delete webhook with given id",
	Args:    cobra.ExactArgs(1),
	Example: "  webhook delete [webhookID]",
	RunE:    withClient(deleteWebhookCmdF),
}
View Source
var DemoteUserToGuestCmd = &cobra.Command{
	Use:     "demote [users]",
	Short:   "Demote users to guests",
	Long:    "Convert a regular user into a guest.",
	Example: "  user demote user1 user2",
	RunE:    withClient(demoteUserToGuestCmdF),
	Args:    cobra.MinimumNArgs(1),
}
View Source
var DisableBotCmd = &cobra.Command{
	Use:     "disable [username]",
	Short:   "Disable bot",
	Long:    "Disable an enabled bot",
	Example: `  bot disable testbot`,
	RunE:    withClient(botDisableCmdF),
	Args:    cobra.MinimumNArgs(1),
}
View Source
var DocsCmd = &cobra.Command{
	Use:   "docs",
	Short: "Generates mmctl documentation",
	Args:  cobra.NoArgs,
	RunE:  docsCmdF,
}
View Source
var EnableBotCmd = &cobra.Command{
	Use:     "enable [username]",
	Short:   "Enable bot",
	Long:    "Enable a disabled bot",
	Example: `  bot enable testbot`,
	RunE:    withClient(botEnableCmdF),
	Args:    cobra.MinimumNArgs(1),
}
View Source
var ExportCmd = &cobra.Command{
	Use:   "export",
	Short: "Management of exports",
}
View Source
var ExportCreateCmd = &cobra.Command{
	Use:   "create",
	Short: "Create export file",
	Args:  cobra.NoArgs,
	RunE:  withClient(exportCreateCmdF),
}
View Source
var ExportDeleteCmd = &cobra.Command{
	Use:     "delete [exportname]",
	Aliases: []string{"rm"},
	Example: "  export delete export_file.zip",
	Short:   "Delete export file",
	Args:    cobra.ExactArgs(1),
	RunE:    withClient(exportDeleteCmdF),
}
View Source
var ExportDownloadCmd = &cobra.Command{
	Use:   "download [exportname] [filepath]",
	Short: "Download export files",
	Example: `  # you can indicate the name of the export and its destination path
  $ mmctl export download samplename sample_export.zip
  
  # or if you only indicate the name, the path would match it
  $ mmctl export download sample_export.zip`,
	Args: cobra.MinimumNArgs(1),
	RunE: withClient(exportDownloadCmdF),
}
View Source
var ExportJobCmd = &cobra.Command{
	Use:   "job",
	Short: "List and show export jobs",
}
View Source
var ExportJobListCmd = &cobra.Command{
	Use:     "list",
	Example: "  export job list",
	Short:   "List export jobs",
	Aliases: []string{"ls"},
	Args:    cobra.NoArgs,
	RunE:    withClient(exportJobListCmdF),
}
View Source
var ExportJobShowCmd = &cobra.Command{
	Use:     "show [exportJobID]",
	Example: "  export job show",
	Short:   "Show export job",
	Args:    cobra.ExactArgs(1),
	RunE:    withClient(exportJobShowCmdF),
}
View Source
var ExportListCmd = &cobra.Command{
	Use:     "list",
	Aliases: []string{"ls"},
	Short:   "List export files",
	Args:    cobra.NoArgs,
	RunE:    withClient(exportListCmdF),
}
View Source
var ExtractCmd = &cobra.Command{
	Use:   "extract",
	Short: "Management of content extraction job.",
}
View Source
var ExtractJobCmd = &cobra.Command{
	Use:   "job",
	Short: "List and show content extraction jobs",
}
View Source
var ExtractJobListCmd = &cobra.Command{
	Use:     "list",
	Example: "  extract job list",
	Short:   "List content extraction jobs",
	Aliases: []string{"ls"},
	Args:    cobra.NoArgs,
	RunE:    withClient(extractJobListCmdF),
}
View Source
var ExtractJobShowCmd = &cobra.Command{
	Use:     "show [extractJobID]",
	Example: " extract job show f3d68qkkm7n8xgsfxwuo498rah",
	Short:   "Show extract job",
	Args:    cobra.ExactArgs(1),
	RunE:    withClient(extractJobShowCmdF),
}
View Source
var ExtractRunCmd = &cobra.Command{
	Use:     "run",
	Example: "  extract run",
	Short:   "Start a content extraction job.",
	Args:    cobra.NoArgs,
	RunE:    withClient(extractRunCmdF),
}
View Source
var GenerateUserTokenCmd = &cobra.Command{
	Use:     "generate [user] [description]",
	Short:   "Generate token for a user",
	Long:    "Generate token for a user",
	Example: "  generate testuser test-token",
	RunE:    withClient(generateTokenForAUserCmdF),
	Args:    cobra.ExactArgs(2),
}
View Source
var GroupCmd = &cobra.Command{
	Use:   "group",
	Short: "Management of groups",
}
View Source
var ImportCmd = &cobra.Command{
	Use:   "import",
	Short: "Management of imports",
}
View Source
var ImportJobCmd = &cobra.Command{
	Use:   "job",
	Short: "List and show import jobs",
}
View Source
var ImportJobListCmd = &cobra.Command{
	Use:     "list",
	Example: "  import job list",
	Short:   "List import jobs",
	Aliases: []string{"ls"},
	Args:    cobra.NoArgs,
	RunE:    withClient(importJobListCmdF),
}
View Source
var ImportJobShowCmd = &cobra.Command{
	Use:     "show [importJobID]",
	Example: " import job show f3d68qkkm7n8xgsfxwuo498rah",
	Short:   "Show import job",
	Args:    cobra.ExactArgs(1),
	RunE:    withClient(importJobShowCmdF),
}
View Source
var ImportListAvailableCmd = &cobra.Command{
	Use:     "available",
	Short:   "List available import files",
	Example: "  import list available",
	Args:    cobra.NoArgs,
	RunE:    withClient(importListAvailableCmdF),
}
View Source
var ImportListCmd = &cobra.Command{
	Use:     "list",
	Aliases: []string{"ls"},
	Short:   "List import files",
	Example: " import list",
}
View Source
var ImportListIncompleteCmd = &cobra.Command{
	Use:     "incomplete",
	Short:   "List incomplete import files uploads",
	Example: "  import list incomplete",
	Args:    cobra.NoArgs,
	RunE:    withClient(importListIncompleteCmdF),
}
View Source
var ImportProcessCmd = &cobra.Command{
	Use:     "process [importname]",
	Example: "  import process 35uy6cwrqfnhdx3genrhqqznxc_import.zip",
	Short:   "Start an import job",
	Args:    cobra.ExactArgs(1),
	RunE:    withClient(importProcessCmdF),
}
View Source
var ImportUploadCmd = &cobra.Command{
	Use:     "upload [filepath]",
	Short:   "Upload import files",
	Example: "  import upload import_file.zip",
	Args:    cobra.ExactArgs(1),
	RunE:    withClient(importUploadCmdF),
}
View Source
var IntegrityCmd = &cobra.Command{
	Use:    "integrity",
	Short:  "Check database records integrity.",
	Long:   "Perform a relational integrity check which returns information about any orphaned record found.",
	Args:   cobra.NoArgs,
	PreRun: localOnlyPrecheck,
	RunE:   withClient(integrityCmdF),
}
View Source
var LdapCmd = &cobra.Command{
	Use:   "ldap",
	Short: "LDAP related utilities",
}
View Source
var LdapIDMigrate = &cobra.Command{
	Use:   "idmigrate <objectGUID>",
	Short: "Migrate LDAP IdAttribute to new value",
	Long: `Migrate LDAP "IdAttribute" to a new value. Run this utility to change the value of your ID Attribute without your users losing their accounts. After running the command you can change the ID Attribute to the new value in the System Console. For example, if your current ID Attribute was "sAMAccountName" and you wanted to change it to "objectGUID", you would:

1. Wait for an off-peak time when your users won’t be impacted by a server restart.
2. Run the command "mmctl ldap idmigrate objectGUID".
3. Update the config within the System Console to the new value "objectGUID".
4. Restart the Mattermost server.`,
	Example: "  ldap idmigrate objectGUID",
	Args:    cobra.ExactArgs(1),
	RunE:    withClient(ldapIDMigrateCmdF),
}
View Source
var LdapSyncCmd = &cobra.Command{
	Use:     "sync",
	Short:   "Synchronize now",
	Long:    "Synchronize all LDAP users and groups now.",
	Example: "  ldap sync",
	RunE:    withClient(ldapSyncCmdF),
}
View Source
var LicenseCmd = &cobra.Command{
	Use:   "license",
	Short: "Licensing commands",
}
View Source
var ListBotCmd = &cobra.Command{
	Use:     "list",
	Short:   "List bots",
	Long:    "List the bots users.",
	Example: `  bot list`,
	RunE:    withClient(botListCmdF),
	Args:    cobra.NoArgs,
}
View Source
var ListChannelsCmd = &cobra.Command{
	Use:   "list [teams]",
	Short: "List all channels on specified teams.",
	Long: `List all channels on specified teams.
Archived channels are appended with ' (archived)'.
Private channels the user is a member of or has access to are appended with ' (private)'.`,
	Example: "  channel list myteam",
	Args:    cobra.MinimumNArgs(1),
	RunE:    withClient(listChannelsCmdF),
}

ListChannelsCmd is a command which lists all the channels of team(s) in a server.

View Source
var ListCmd = &cobra.Command{
	Use:     "list",
	Short:   "Lists the credentials",
	Long:    "Print a list of the registered credentials",
	Example: `  auth list`,
	RunE:    listCmdF,
}
View Source
var ListLdapGroupsCmd = &cobra.Command{
	Use:     "list-ldap",
	Short:   "List LDAP groups",
	Example: "  group list-ldap",
	Args:    cobra.NoArgs,
	RunE:    withClient(listLdapGroupsCmdF),
}
View Source
var ListTeamsCmd = &cobra.Command{
	Use:     "list",
	Short:   "List all teams",
	Long:    `List all teams on the server.`,
	Example: "  team list",
	RunE:    withClient(listTeamsCmdF),
}
View Source
var ListUserTokensCmd = &cobra.Command{
	Use:     "list [user]",
	Short:   "List users tokens",
	Long:    "List the tokens of a user",
	Example: "  user tokens testuser",
	RunE:    withClient(listTokensOfAUserCmdF),
	Args:    cobra.ExactArgs(1),
}
View Source
var ListUsersCmd = &cobra.Command{
	Use:     "list",
	Short:   "List users",
	Long:    "List all users",
	Example: "  user list",
	RunE:    withClient(listUsersCmdF),
	Args:    cobra.NoArgs,
}
View Source
var ListWebhookCmd = &cobra.Command{
	Use:     "list",
	Short:   "List webhooks",
	Long:    "list all webhooks",
	Example: "  webhook list myteam",
	RunE:    withClient(listWebhookCmdF),
}
View Source
var LoginCmd = &cobra.Command{
	Use:   "login [instance url] --name [server name] --username [username] --password-file [password-file]",
	Short: "Login into an instance",
	Long:  "Login into an instance and store credentials",
	Example: `  auth login https://mattermost.example.com
  auth login https://mattermost.example.com --name local-server --username sysadmin --password-file mysupersecret.txt
  auth login https://mattermost.example.com --name local-server --username sysadmin --password-file mysupersecret.txt --mfa-token 123456
  auth login https://mattermost.example.com --name local-server --access-token myaccesstoken`,
	Args: cobra.ExactArgs(1),
	RunE: loginCmdF,
}
View Source
var LogsCmd = &cobra.Command{
	Use:   "logs",
	Short: "Display logs in a human-readable format",
	Long:  "Display logs in a human-readable format. As the logs format depends on the server, the \"--format\" flag cannot be used with this command.",
	RunE:  withClient(logsCmdF),
}
View Source
var MakeChannelPrivateCmd = &cobra.Command{
	Use:     "make-private [channel]",
	Aliases: []string{"make_private"},
	Short:   "Set a channel's type to private",
	Long: `Set the type of a channel from Public to Private.
Channel can be specified by [team]:[channel]. ie. myteam:mychannel or by channel ID.`,
	Example: "  channel make-private myteam:mychannel",
	RunE:    withClient(makeChannelPrivateCmdF),
}
View Source
var MigrateAuthCmd = &cobra.Command{
	Use:     "migrate-auth [from_auth] [to_auth] [migration-options]",
	Aliases: []string{"migrate_auth"},
	Short:   "Mass migrate user accounts authentication type",
	Long:    `Migrates accounts from one authentication provider to another. For example, you can upgrade your authentication provider from email to ldap.`,
	Example: "user migrate-auth email saml users.json",
	Args: func(command *cobra.Command, args []string) error {
		if len(args) < 2 {
			return errors.New("auth migration requires at least 2 arguments")
		}

		toAuth := args[1]

		if toAuth != "ldap" && toAuth != "saml" {
			return errors.New("invalid to_auth parameter, must be saml or ldap")
		}

		if toAuth == "ldap" && len(args) != 3 {
			return errors.New("ldap migration requires 3 arguments")
		}

		autoFlag, _ := command.Flags().GetBool("auto")

		if toAuth == "saml" && autoFlag {
			if len(args) != 2 {
				return errors.New("saml migration requires two arguments when using the --auto flag")
			}
		}

		if toAuth == "saml" && !autoFlag {
			if len(args) != 3 {
				return errors.New("saml migration requires three arguments when not using the --auto flag")
			}
		}
		return nil
	},
	RunE: withClient(migrateAuthCmdF),
}
View Source
var ModifyChannelCmd = &cobra.Command{
	Use:   "modify [channel] [flags]",
	Short: "Modify a channel's public/private type",
	Long: `Change the Public/Private type of a channel.
Channel can be specified by [team]:[channel]. ie. myteam:mychannel or by channel ID.`,
	Example: `  channel modify myteam:mychannel --private
  channel modify channelId --public`,
	Args: cobra.ExactArgs(1),
	RunE: withClient(modifyChannelCmdF),
}
View Source
var ModifyIncomingWebhookCmd = &cobra.Command{
	Use:     "modify-incoming",
	Short:   "Modify incoming webhook",
	Long:    "Modify existing incoming webhook by changing its title, description, channel or icon url",
	Args:    cobra.ExactArgs(1),
	Example: "  webhook modify-incoming [webhookID] --channel [channelID] --display-name [displayName] --description [webhookDescription] --lock-to-channel --icon [iconURL]",
	RunE:    withClient(modifyIncomingWebhookCmdF),
}
View Source
var ModifyOutgoingWebhookCmd = &cobra.Command{
	Use:     "modify-outgoing",
	Short:   "Modify outgoing webhook",
	Long:    "Modify existing outgoing webhook by changing its title, description, channel, icon, url, content-type, and triggers",
	Args:    cobra.ExactArgs(1),
	Example: `  webhook modify-outgoing [webhookId] --channel [channelId] --display-name [displayName] --description "New webhook description" --icon http://localhost:8000/my-slash-handler-bot-icon.png --url http://localhost:8000/my-webhook-handler --content-type "application/json" --trigger-word test --trigger-when start`,
	RunE:    withClient(modifyOutgoingWebhookCmdF),
}
View Source
var ModifyTeamsCmd = &cobra.Command{
	Use:     "modify [teams] [flag]",
	Short:   "Modify teams",
	Long:    "Modify teams' privacy setting to public or private",
	Example: "  team modify myteam --private",
	Args:    cobra.MinimumNArgs(1),
	RunE:    withClient(modifyTeamsCmdF),
}
View Source
var MoveChannelCmd = &cobra.Command{
	Use:   "move [team] [channels]",
	Short: "Moves channels to the specified team",
	Long: `Moves the provided channels to the specified team.
Validates that all users in the channel belong to the target team. Incoming/Outgoing webhooks are moved along with the channel.
Channels can be specified by [team]:[channel]. ie. myteam:mychannel or by channel ID.`,
	Example: "  channel move newteam oldteam:mychannel",
	Args:    cobra.MinimumNArgs(2),
	RunE:    withClient(moveChannelCmdF),
}
View Source
var PermissionsCmd = &cobra.Command{
	Use:   "permissions",
	Short: "Management of permissions",
}
View Source
var PluginAddCmd = &cobra.Command{
	Use:     "add [plugins]",
	Short:   "Add plugins",
	Long:    "Add plugins to your Mattermost server.",
	Example: `  plugin add hovercardexample.tar.gz pluginexample.tar.gz`,
	RunE:    withClient(pluginAddCmdF),
	Args:    cobra.MinimumNArgs(1),
}
View Source
var PluginCmd = &cobra.Command{
	Use:   "plugin",
	Short: "Management of plugins",
}
View Source
var PluginDeleteCmd = &cobra.Command{
	Use:     "delete [plugins]",
	Short:   "Delete plugins",
	Long:    "Delete previously uploaded plugins from your Mattermost server.",
	Example: `  plugin delete hovercardexample pluginexample`,
	RunE:    withClient(pluginDeleteCmdF),
	Args:    cobra.MinimumNArgs(1),
}
View Source
var PluginDisableCmd = &cobra.Command{
	Use:     "disable [plugins]",
	Short:   "Disable plugins",
	Long:    "Disable plugins. Disabled plugins are immediately removed from the user interface and logged out of all sessions.",
	Example: `  plugin disable hovercardexample pluginexample`,
	RunE:    withClient(pluginDisableCmdF),
	Args:    cobra.MinimumNArgs(1),
}
View Source
var PluginEnableCmd = &cobra.Command{
	Use:     "enable [plugins]",
	Short:   "Enable plugins",
	Long:    "Enable plugins for use on your Mattermost server.",
	Example: `  plugin enable hovercardexample pluginexample`,
	RunE:    withClient(pluginEnableCmdF),
	Args:    cobra.MinimumNArgs(1),
}
View Source
var PluginInstallURLCmd = &cobra.Command{
	Use:   "install-url <url>...",
	Short: "Install plugin from url",
	Long:  "Supply one or multiple URLs to plugins compressed in a .tar.gz file. Plugins must be enabled in the server's config settings",
	Example: `  # You can install one plugin
  $ mmctl plugin install-url https://example.com/mattermost-plugin.tar.gz

  # Or install multiple in one go
  $ mmctl plugin install-url https://example.com/mattermost-plugin-one.tar.gz https://example.com/mattermost-plugin-two.tar.gz`,
	RunE: withClient(pluginInstallURLCmdF),
	Args: cobra.MinimumNArgs(1),
}
View Source
var PluginListCmd = &cobra.Command{
	Use:     "list",
	Short:   "List plugins",
	Long:    "List all enabled and disabled plugins installed on your Mattermost server.",
	Example: `  plugin list`,
	RunE:    withClient(pluginListCmdF),
}
View Source
var PluginMarketplaceCmd = &cobra.Command{
	Use:   "marketplace",
	Short: "Management of marketplace plugins",
}
View Source
var PluginMarketplaceInstallCmd = &cobra.Command{
	Use:   "install <id> [version]",
	Short: "Install a plugin from the marketplace",
	Long:  "Installs a plugin listed in the marketplace server",
	Example: `  # you can specify with both the plugin id and its version
  $ mmctl plugin marketplace install jitsi 2.0.0

  # if you don't specify the version, the latest one will be installed
  $ mmctl plugin marketplace install jitsi`,
	Args: cobra.MinimumNArgs(1),
	RunE: withClient(pluginMarketplaceInstallCmdF),
}
View Source
var PluginMarketplaceListCmd = &cobra.Command{
	Use:   "list",
	Short: "List marketplace plugins",
	Long:  "Gets all plugins from the marketplace server, merging data from locally installed plugins as well as prepackaged plugins shipped with the server",
	Example: `  # You can list all the plugins
  $ mmctl plugin marketplace list --all

  # Pagination options can be used too
  $ mmctl plugin marketplace list --page 2 --per-page 10

  # Filtering will narrow down the search
  $ mmctl plugin marketplace list --filter jit

  # You can only retrieve local plugins
  $ mmctl plugin marketplace list --local-only`,
	Args: cobra.NoArgs,
	RunE: withClient(pluginMarketplaceListCmdF),
}
View Source
var PostCmd = &cobra.Command{
	Use:   "post",
	Short: "Management of posts",
}
View Source
var PostCreateCmd = &cobra.Command{
	Use:     "create",
	Short:   "Create a post",
	Example: `  post create myteam:mychannel --message "some text for the post"`,
	Args:    cobra.ExactArgs(1),
	RunE:    withClient(postCreateCmdF),
}
View Source
var PostListCmd = &cobra.Command{
	Use:   "list",
	Short: "List posts for a channel",
	Example: `  post list myteam:mychannel
  post list myteam:mychannel --number 20`,
	Args: cobra.ExactArgs(1),
	RunE: withClient(postListCmdF),
}
View Source
var PromoteGuestToUserCmd = &cobra.Command{
	Use:     "promote [guests]",
	Short:   "Promote guests to users",
	Long:    "Convert a guest into a regular user.",
	Example: "  user promote guest1 guest2",
	RunE:    withClient(promoteGuestToUserCmdF),
	Args:    cobra.MinimumNArgs(1),
}
View Source
var RemoveChannelUsersCmd = &cobra.Command{
	Use:   "remove [channel] [users]",
	Short: "Remove users from channel",
	Long:  "Remove some users from channel",
	Example: `  channel remove myteam:mychannel user@example.com username
  channel remove myteam:mychannel --all-users`,
	Deprecated: "please use \"users remove\" instead",
	RunE:       withClient(channelUsersRemoveCmdF),
}
View Source
var RemoveLicenseCmd = &cobra.Command{
	Use:     "remove",
	Short:   "Remove the current license.",
	Long:    "Remove the current license and leave mattermost in Team Edition.",
	Example: "  license remove",
	RunE:    withClient(removeLicenseCmdF),
}
View Source
var RemovePermissionsCmd = &cobra.Command{
	Use:   "remove <role> <permission...>",
	Short: "Remove permissions from a role (EE Only)",
	Long:  `Remove one or more permissions from an existing role (Only works in Enterprise Edition).`,
	Example: `  permissions remove system_user list_open_teams
  permissions remove system_manager sysconsole_read_user_management_channels`,
	Args: cobra.MinimumNArgs(2),
	RunE: withClient(removePermissionsCmdF),
}
View Source
var RenameTeamCmd = &cobra.Command{
	Use:     "rename [team]",
	Short:   "Rename team",
	Long:    "Rename an existing team",
	Example: "  team rename old-team --display-name 'New Display Name'",
	Args:    cobra.ExactArgs(1),
	RunE:    withClient(renameTeamCmdF),
}

RenameTeamCmd is the command to rename team along with its display name

View Source
var RenewCmd = &cobra.Command{
	Use:     "renew",
	Short:   "Renews a set of credentials",
	Long:    "Renews the credentials for a given server",
	Example: `  auth renew local-server`,
	Args:    cobra.ExactArgs(1),
	RunE:    renewCmdF,
}
View Source
var ResetCmd = &cobra.Command{
	Use:   "reset <role_name>",
	Short: "Reset default permissions for role (EE Only)",
	Long:  "Reset the given role's permissions to the set that was originally released with",
	Example: `  # Reset the permissions of the 'system_read_only_admin' role.
  $ mmctl permissions reset system_read_only_admin`,
	Args: cobra.ExactArgs(1),
	RunE: withClient(resetPermissionsCmdF),
}
View Source
var ResetUserMfaCmd = &cobra.Command{
	Use:   "resetmfa [users]",
	Short: "Turn off MFA",
	Long: `Turn off multi-factor authentication for a user.
If MFA enforcement is enabled, the user will be forced to re-enable MFA as soon as they log in.`,
	Example: "  user resetmfa user@example.com",
	RunE:    withClient(resetUserMfaCmdF),
}
View Source
var RestoreChannelsCmd = &cobra.Command{
	Use:        "restore [channels]",
	Deprecated: "please use \"unarchive\" instead",
	Short:      "Restore some channels",
	Long: `Restore a previously deleted channel
Channels can be specified by [team]:[channel]. ie. myteam:mychannel or by channel ID.`,
	Example: "  channel restore myteam:mychannel",
	RunE:    withClient(unarchiveChannelsCmdF),
}
View Source
var RestoreTeamsCmd = &cobra.Command{
	Use:     "restore [teams]",
	Short:   "Restore teams",
	Long:    "Restores archived teams.",
	Example: "  team restore myteam",
	Args:    cobra.MinimumNArgs(1),
	RunE:    withClient(restoreTeamsCmdF),
}
View Source
var RevokeUserTokenCmd = &cobra.Command{
	Use:     "revoke [token-ids]",
	Short:   "Revoke tokens for a user",
	Long:    "Revoke tokens for a user",
	Example: "  revoke testuser test-token-id",
	RunE:    withClient(revokeTokenForAUserCmdF),
	Args:    cobra.MinimumNArgs(1),
}
View Source
var RoleCmd = &cobra.Command{
	Use:   "role",
	Short: "Management of roles",
}
View Source
var RolesCmd = &cobra.Command{
	Use:   "roles",
	Short: "Manage user roles",
}
View Source
var RolesMemberCmd = &cobra.Command{
	Use:   "member [users]",
	Short: "Remove system admin privileges",
	Long:  "Remove system admin privileges from some users.",
	Example: `  # You can remove admin privileges from one user
  $ mmctl roles member john_doe

  # Or demote multiple users at the same time
  $ mmctl roles member john_doe jane_doe`,
	RunE: withClient(rolesMemberCmdF),
	Args: cobra.MinimumNArgs(1),
}
View Source
var RolesSystemAdminCmd = &cobra.Command{
	Use:     "system-admin [users]",
	Aliases: []string{"system_admin"},
	Short:   "Set a user as system admin",
	Long:    "Make some users system admins.",
	Example: `  # You can make one user a sysadmin
  $ mmctl roles system-admin john_doe

  # Or promote multiple users at the same time
  $ mmctl roles system-admin john_doe jane_doe`,
	RunE: withClient(rolesSystemAdminCmdF),
	Args: cobra.MinimumNArgs(1),
}
View Source
var RootCmd = &cobra.Command{
	Use:               "mmctl",
	Short:             "Remote client for the Open Source, self-hosted Slack-alternative",
	Long:              `Mattermost offers workplace messaging across web, PC and phones with archiving, search and integration with your existing systems. Documentation available at https://docs.mattermost.com`,
	DisableAutoGenTag: true,
	PersistentPreRun: func(cmd *cobra.Command, args []string) {
		format := viper.GetString("format")
		if viper.GetBool("disable-pager") {
			printer.OverrideEnablePager(false)
		}

		printer.SetCommand(cmd)
		isJSON := viper.GetBool("json")
		if isJSON || format == printer.FormatJSON {
			printer.SetFormat(printer.FormatJSON)
		} else {
			printer.SetFormat(printer.FormatPlain)
		}
		quiet := viper.GetBool("quiet")
		printer.SetQuiet(quiet)
	},
	PersistentPostRun: func(cmd *cobra.Command, args []string) {
		_ = printer.Flush()
	},
	SilenceUsage: true,
}
View Source
var SamlAuthDataResetCmd = &cobra.Command{
	Use:   "auth-data-reset",
	Short: "Reset AuthData field to Email",
	Long:  "Resets the AuthData field for SAML users to their email. Run this utility after setting the 'id' SAML attribute to an empty value.",
	Example: `  # Reset all SAML users' AuthData field to their email, including deleted users
  $ mmctl saml auth-data-reset --include-deleted

  # Show how many users would be affected by the reset
  $ mmctl saml auth-data-reset --dry-run

  # Skip confirmation for resetting the AuthData
  $ mmctl saml auth-data-reset -y

  # Only reset the AuthData for the following SAML users
  $ mmctl saml auth-data-reset --users userid1,userid2`,
	RunE: withClient(samlAuthDataResetCmdF),
}
View Source
var SamlCmd = &cobra.Command{
	Use:   "saml",
	Short: "SAML related utilities",
}
View Source
var SampledataCmd = &cobra.Command{
	Use:   "sampledata",
	Short: "Generate sample data",
	Long:  "Generate a sample data file and store it locally, or directly import it to the remote server",
	Example: `  # you can create a sampledata file and store it locally
  $ mmctl sampledata --bulk sampledata-file.jsonl

  # or you can simply print it to the stdout
  $ mmctl sampledata --bulk -

  # the amount of entities to create can be customized
  $ mmctl sampledata -t 7 -u 20 -g 4

  # the sampledata file can be directly imported in the remote server by not specifying a --bulk flag
  $ mmctl sampledata

  # and the sample users can be created with profile pictures
  $ mmctl sampledata --profile-images ./images/profiles`,
	Args: cobra.NoArgs,
	RunE: withClient(sampledataCmdF),
}
View Source
var SearchChannelCmd = &cobra.Command{
	Use:   "search [channel]\n  mmctl search --team [team] [channel]",
	Short: "Search a channel",
	Long: `Search a channel by channel name.
Channel can be specified by team. ie. --team myteam mychannel or by team ID.`,
	Example: `  channel search mychannel
  channel search --team myteam mychannel`,
	Args: cobra.ExactArgs(1),
	RunE: withClient(searchChannelCmdF),
}
View Source
var SearchTeamCmd = &cobra.Command{
	Use:     "search [teams]",
	Short:   "Search for teams",
	Long:    "Search for teams based on name",
	Example: "  team search team1",
	Args:    cobra.MinimumNArgs(1),
	RunE:    withClient(searchTeamCmdF),
}
View Source
var SearchUserCmd = &cobra.Command{
	Use:     "search [users]",
	Short:   "Search for users",
	Long:    "Search for users based on username, email, or user ID.",
	Example: "  user search user1@mail.com user2@mail.com",
	RunE:    withClient(searchUserCmdF),
}
View Source
var SendPasswordResetEmailCmd = &cobra.Command{
	Use:     "reset-password [users]",
	Aliases: []string{"reset_password"},
	Short:   "Send users an email to reset their password",
	Long:    "Send users an email to reset their password",
	Example: "  user reset-password user@example.com",
	RunE:    withClient(sendPasswordResetEmailCmdF),
}
View Source
var SetCmd = &cobra.Command{
	Use:     "set [server name]",
	Short:   "Set the credentials to use",
	Long:    "Set an credentials to use in the following commands",
	Example: `  auth set local-server`,
	Args:    cobra.ExactArgs(1),
	RunE:    setCmdF,
}
View Source
var ShowCmd = &cobra.Command{
	Use:     "show <role_name>",
	Short:   "Show the role information",
	Long:    "Show all the information about a role.",
	Example: `  permissions show system_user`,
	Args:    cobra.ExactArgs(1),
	RunE:    withClient(showRoleCmdF),
}
View Source
var ShowRoleCmd = &cobra.Command{
	Use:        "show <role_name>",
	Deprecated: "please use \"role show\" instead",
	Short:      "Show the role information",
	Long:       "Show all the information about a role.",
	Example:    `  permissions show system_user`,
	Args:       cobra.ExactArgs(1),
	RunE:       withClient(showRoleCmdF),
}
View Source
var ShowWebhookCmd = &cobra.Command{
	Use:     "show [webhookId]",
	Short:   "Show a webhook",
	Long:    "Show the webhook specified by [webhookId]",
	Args:    cobra.ExactArgs(1),
	Example: "  webhook show w16zb5tu3n1zkqo18goqry1je",
	RunE:    withClient(showWebhookCmdF),
}
View Source
var SystemClearBusyCmd = &cobra.Command{
	Use:     "clearbusy",
	Short:   "Clears the busy state",
	Long:    `Clear the busy state, which re-enables non-critical services.`,
	Example: `  system clearbusy`,
	Args:    cobra.NoArgs,
	RunE:    withClient(clearBusyCmdF),
}
View Source
var SystemCmd = &cobra.Command{
	Use:   "system",
	Short: "System management",
	Long:  `System management commands for interacting with the server state and configuration.`,
}
View Source
var SystemGetBusyCmd = &cobra.Command{
	Use:     "getbusy",
	Short:   "Get the current busy state",
	Long:    `Gets the server busy state (high load) and timestamp corresponding to when the server busy flag will be automatically cleared.`,
	Example: `  system getbusy`,
	Args:    cobra.NoArgs,
	RunE:    withClient(getBusyCmdF),
}
View Source
var SystemSetBusyCmd = &cobra.Command{
	Use:     "setbusy -s [seconds]",
	Short:   "Set the busy state to true",
	Long:    `Set the busy state to true for the specified number of seconds, which disables non-critical services.`,
	Example: `  system setbusy -s 3600`,
	Args:    cobra.NoArgs,
	RunE:    withClient(setBusyCmdF),
}
View Source
var SystemStatusCmd = &cobra.Command{
	Use:     "status",
	Short:   "Prints the status of the server",
	Long:    "Prints the server status calculated using several basic server healthchecks",
	Example: `  system status`,
	Args:    cobra.NoArgs,
	RunE:    withClient(systemStatusCmdF),
}
View Source
var SystemVersionCmd = &cobra.Command{
	Use:     "version",
	Short:   "Prints the remote server version",
	Long:    "Prints the server version of the currently connected Mattermost instance",
	Example: `  system version`,
	Args:    cobra.NoArgs,
	RunE:    withClient(systemVersionCmdF),
}
View Source
var TeamCmd = &cobra.Command{
	Use:   "team",
	Short: "Management of teams",
}
View Source
var TeamCreateCmd = &cobra.Command{
	Use:   "create",
	Short: "Create a team",
	Long:  `Create a team.`,
	Example: `  team create --name mynewteam --display-name "My New Team"
  team create --name private --display-name "My New Private Team" --private`,
	RunE: withClient(createTeamCmdF),
}
View Source
var TeamGroupCmd = &cobra.Command{
	Use:   "team",
	Short: "Management of team groups",
}
View Source
var TeamGroupDisableCmd = &cobra.Command{
	Use:     "disable [team]",
	Short:   "Disables group constrains in the specified team",
	Example: "  group team disable myteam",
	Args:    cobra.ExactArgs(1),
	RunE:    withClient(teamGroupDisableCmdF),
}
View Source
var TeamGroupEnableCmd = &cobra.Command{
	Use:     "enable [team]",
	Short:   "Enables group constrains in the specified team",
	Example: "  group team enable myteam",
	Args:    cobra.ExactArgs(1),
	RunE:    withClient(teamGroupEnableCmdF),
}
View Source
var TeamGroupListCmd = &cobra.Command{
	Use:     "list [team]",
	Short:   "List team groups",
	Long:    "List the groups associated with a team",
	Example: "  group team list myteam",
	Args:    cobra.ExactArgs(1),
	RunE:    withClient(teamGroupListCmdF),
}
View Source
var TeamGroupStatusCmd = &cobra.Command{
	Use:     "status [team]",
	Short:   "Show's the group constrain status for the specified team",
	Example: "  group team status myteam",
	Args:    cobra.ExactArgs(1),
	RunE:    withClient(teamGroupStatusCmdF),
}
View Source
var TeamUsersAddCmd = &cobra.Command{
	Use:     "add [team] [users]",
	Short:   "Add users to team",
	Long:    "Add some users to team",
	Example: "  team add myteam user@example.com username",
	Args:    cobra.MinimumNArgs(2),
	RunE:    withClient(teamUsersAddCmdF),
}
View Source
var TeamUsersCmd = &cobra.Command{
	Use:   "users",
	Short: "Management of team users",
}
View Source
var TeamUsersRemoveCmd = &cobra.Command{
	Use:     "remove [team] [users]",
	Short:   "Remove users from team",
	Long:    "Remove some users from team",
	Example: "  team remove myteam user@example.com username",
	Args:    cobra.MinimumNArgs(2),
	RunE:    withClient(teamUsersRemoveCmdF),
}
View Source
var TokenCmd = &cobra.Command{
	Use:   "token",
	Short: "manage users' access tokens",
}
View Source
var UnarchiveChannelCmd = &cobra.Command{
	Use:   "unarchive [channels]",
	Short: "Unarchive some channels",
	Long: `Unarchive a previously archived channel
Channels can be specified by [team]:[channel]. ie. myteam:mychannel or by channel ID.`,
	Example: "  channel unarchive myteam:mychannel",
	RunE:    withClient(unarchiveChannelsCmdF),
}
View Source
var UnassignCmd = &cobra.Command{
	Use:   "unassign <role_name> <username...>",
	Short: "Unassign users from role (EE Only)",
	Long:  "Unassign users from a role by username (Only works in Enterprise Edition).",
	Example: `  # Unassign users with usernames 'john.doe' and 'jane.doe' from the role named 'system_admin'.
  permissions unassign system_admin john.doe jane.doe

  # Examples using other system roles
  permissions unassign system_manager john.doe jane.doe
  permissions unassign system_user_manager john.doe jane.doe
  permissions unassign system_read_only_admin john.doe jane.doe`,
	Args: cobra.MinimumNArgs(2),
	RunE: withClient(unassignUsersCmdF),
}
View Source
var UpdateBotCmd = &cobra.Command{
	Use:     "update [username]",
	Short:   "Update bot",
	Long:    "Update bot information.",
	Example: `  bot update testbot --username newbotusername`,
	RunE:    withClient(botUpdateCmdF),
	Args:    cobra.ExactArgs(1),
}
View Source
var UpdateUserEmailCmd = &cobra.Command{
	Use:     "email [user] [new email]",
	Short:   "Change email of the user",
	Long:    "Change the email address associated with a user.",
	Example: "  user email testuser user@example.com",
	RunE:    withClient(updateUserEmailCmdF),
}
View Source
var UpdateUsernameCmd = &cobra.Command{
	Use:     "username [user] [new username]",
	Short:   "Change username of the user",
	Long:    "Change username of the user.",
	Example: "  user username testuser newusername",
	Args:    cobra.ExactArgs(2),
	RunE:    withClient(updateUsernameCmdF),
}
View Source
var UploadLicenseCmd = &cobra.Command{
	Use:     "upload [license]",
	Short:   "Upload a license.",
	Long:    "Upload a license. Replaces current license.",
	Example: "  license upload /path/to/license/mylicensefile.mattermost-license",
	RunE:    withClient(uploadLicenseCmdF),
}
View Source
var UserActivateCmd = &cobra.Command{
	Use:   "activate [emails, usernames, userIds]",
	Short: "Activate users",
	Long:  "Activate users that have been deactivated.",
	Example: `  user activate user@example.com
  user activate username`,
	RunE: withClient(userActivateCmdF),
	Args: cobra.MinimumNArgs(1),
}
View Source
var UserCmd = &cobra.Command{
	Use:   "user",
	Short: "Management of users",
}
View Source
var UserConvertCmd = &cobra.Command{
	Use:   "convert (--bot [emails] [usernames] [userIds] | --user <username> --password PASSWORD [--email EMAIL])",
	Short: "Convert users to bots, or a bot to a user",
	Long:  "Convert user accounts to bots or convert bots to user accounts.",
	Example: `  # you can convert a user to a bot providing its email, id or username
  $ mmctl user convert user@example.com --bot

  # or multiple users in one go
  $ mmctl user convert user@example.com anotherUser --bot

  # you can convert a bot to a user specifying the email and password that the user will have after conversion
  $ mmctl user convert botusername --email new.email@email.com --password password --user`,
	RunE: withClient(userConvertCmdF),
	Args: cobra.MinimumNArgs(1),
}
View Source
var UserCreateCmd = &cobra.Command{
	Use:   "create",
	Short: "Create a user",
	Long:  "Create a user",
	Example: `  # You can create a user
  $ mmctl user create --email user@example.com --username userexample --password Password1

  # You can define optional fields like first name, last name and nick name too
  $ mmctl user create --email user@example.com --username userexample --password Password1 --firstname User --lastname Example --nickname userex

  # Also you can create the user as system administrator
  $ mmctl user create --email user@example.com --username userexample --password Password1 --system-admin

  # Finally you can verify user on creation if you have enough permissions
  $ mmctl user create --email user@example.com --username userexample --password Password1 --system-admin --email-verified`,
	RunE: withClient(userCreateCmdF),
}
View Source
var UserDeactivateCmd = &cobra.Command{
	Use:   "deactivate [emails, usernames, userIds]",
	Short: "Deactivate users",
	Long:  "Deactivate users. Deactivated users are immediately logged out of all sessions and are unable to log back in.",
	Example: `  user deactivate user@example.com
  user deactivate username`,
	RunE: withClient(userDeactivateCmdF),
	Args: cobra.MinimumNArgs(1),
}
View Source
var UserInviteCmd = &cobra.Command{
	Use:   "invite [email] [teams]",
	Short: "Send user an email invite to a team.",
	Long: `Send user an email invite to a team.
You can invite a user to multiple teams by listing them.
You can specify teams by name or ID.`,
	Example: `  user invite user@example.com myteam
  user invite user@example.com myteam1 myteam2`,
	RunE: withClient(userInviteCmdF),
}
View Source
var VerifyUserEmailWithoutTokenCmd = &cobra.Command{
	Use:     "verify [users]",
	Short:   "Verify email of users",
	Long:    "Verify the user's email address.",
	Example: "  user verify user1",
	RunE:    withClient(verifyUserEmailWithoutTokenCmdF),
	Args:    cobra.MinimumNArgs(1),
}
View Source
var (
	Version = "6.4.0"
)
View Source
var VersionCmd = &cobra.Command{
	Use:   "version",
	Short: "Prints the version of mmctl.",
	RunE:  versionCmdF,
}
View Source
var WebhookCmd = &cobra.Command{
	Use:   "webhook",
	Short: "Management of webhooks",
}
View Source
var WebsocketCmd = &cobra.Command{
	Use:   "websocket",
	Short: "Display websocket in a human-readable format",
	RunE:  websocketCmdF,
}
View Source
var ZshCmd = &cobra.Command{
	Use:   "zsh",
	Short: "Generates the zsh autocompletion scripts",
	Long: `To load completion, run

. <(mmctl completion zsh)

To configure your zsh shell to load completions for each session, add the above line to your ~/.zshrc
`,
	RunE: zshCmdF,
}

Functions

func CheckVersionMatch

func CheckVersionMatch(version, serverVersion string) bool

func CleanCredentials

func CleanCredentials() error

func ExtractErrorFromResponse

func ExtractErrorFromResponse(r *model.Response, err error) error

ExtractErrorFromResponse extracts the error from the response, encapsulating it if matches the common cases, such as when it's not found, and when we've made a bad request

func InitClient

func InitClient(allowInsecureSHA1, allowInsecureTLS bool) (*model.Client4, string, error)

func InitClientWithCredentials

func InitClientWithCredentials(credentials *Credentials, allowInsecureSHA1, allowInsecureTLS bool) (*model.Client4, string, error)

func InitClientWithMFA

func InitClientWithMFA(username, password, mfaToken, instanceURL string, allowInsecureSHA1, allowInsecureTLS bool) (*model.Client4, string, error)

func InitClientWithUsernameAndPassword

func InitClientWithUsernameAndPassword(username, password, instanceURL string, allowInsecureSHA1, allowInsecureTLS bool) (*model.Client4, string, error)

func InitUnixClient

func InitUnixClient(socketPath string) (*model.Client4, error)

func InitWebSocketClient

func InitWebSocketClient() (*model.WebSocketClient, error)

func NewAPIv4Client

func NewAPIv4Client(instanceURL string, allowInsecureSHA1, allowInsecureTLS bool) *model.Client4

func Run

func Run(args []string) error

func SaveCredentials

func SaveCredentials(credentials Credentials) error

func SaveCredentialsList

func SaveCredentialsList(credentialsList *CredentialsList) error

func SetCurrent

func SetCurrent(name string) error

func SetUser

func SetUser(newUser *user.User)

func VerifyCertificates

func VerifyCertificates(rawCerts [][]byte, verifiedChains [][]*x509.Certificate) error

Types

type BadRequestError

type BadRequestError struct {
	Msg string
}

func (*BadRequestError) Error

func (e *BadRequestError) Error() string

type Credentials

type Credentials struct {
	Name        string `json:"name"`
	Username    string `json:"username"`
	AuthToken   string `json:"authToken"`
	AuthMethod  string `json:"authMethod"`
	InstanceURL string `json:"instanceUrl"`
	Active      bool   `json:"active"`
}

func GetCredentials

func GetCredentials(name string) (*Credentials, error)

func GetCurrentCredentials

func GetCurrentCredentials() (*Credentials, error)

type CredentialsList

type CredentialsList map[string]*Credentials

func ReadCredentialsList

func ReadCredentialsList() (*CredentialsList, error)

type ErrEntityNotFound

type ErrEntityNotFound struct {
	Type string
	ID   string
}

ErrEntityNotFound is thrown when an entity (user, team, etc.) is not found, returning the id sent by arguments

func (ErrEntityNotFound) Error

func (e ErrEntityNotFound) Error() string

type Info

type Info struct {
	Version      string
	GitCommit    string
	GitTreeState string
	BuildDate    string
	GoVersion    string
	Compiler     string
	Platform     string
}

type NotFoundError

type NotFoundError struct {
	Msg string
}

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

type StoreResult

type StoreResult struct {
	Data interface{}
	Err  error
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL