commands

package
v0.0.0-...-16753fb Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2021 License: AGPL-3.0, Apache-2.0 Imports: 45 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DeactivatedUser = "deactivated"
	GuestUser       = "guest"
)
View Source
const ChannelArgSeparator = ":"
View Source
const CommandArgsSeparator = ":"
View Source
const CustomDefaultsEnvVar = "MM_CUSTOM_DEFAULTS_PATH"

Variables

View Source
var ActianceExportCmd = &cobra.Command{
	Use:     "actiance",
	Short:   "Export data from Mattermost in Actiance format",
	Long:    "Export data from Mattermost in Actiance format",
	Example: "export actiance --exportFrom=12345",
	RunE:    buildExportCmdF("actiance"),
}
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",
	Args:    cobra.MinimumNArgs(2),
	RunE:    addChannelUsersCmdF,
}
View Source
var AddUsersCmd = &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:    addUsersCmdF,
}
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",
	Args:    cobra.MinimumNArgs(1),
	RunE:    archiveChannelsCmdF,
}
View Source
var ArchiveTeamCmd = &cobra.Command{
	Use:     "archive [teams]",
	Short:   "Archive teams",
	Long:    "Archive teams based on name",
	Example: "  team archive team1",
	Args:    cobra.MinimumNArgs(1),
	RunE:    archiveTeamCmdF,
}
View Source
var BulkExportCmd = &cobra.Command{
	Use:     "bulk [file]",
	Short:   "Export bulk data.",
	Long:    "Export data to a file compatible with the Mattermost Bulk Import format.",
	Example: "export bulk bulk_data.json",
	RunE:    bulkExportCmdF,
	Args:    cobra.ExactArgs(1),
}
View Source
var BulkImportCmd = &cobra.Command{
	Use:     "bulk [file]",
	Short:   "Import bulk data.",
	Long:    "Import data from a Mattermost Bulk Import File.",
	Example: "  import bulk bulk_data.json",
	RunE:    bulkImportCmdF,
}
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: 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 constraint on the specified channel",
	Example: "  group channel disable myteam:mychannel",
	Args:    cobra.ExactArgs(1),
	RunE:    channelGroupDisableCmdF,
}
View Source
var ChannelGroupEnableCmd = &cobra.Command{
	Use:     "enable [team]:[channel]",
	Short:   "Enables group constraint on the specified channel",
	Example: "  group channel enable myteam:mychannel",
	Args:    cobra.ExactArgs(1),
	RunE:    channelGroupEnableCmdF,
}
View Source
var ChannelGroupListCmd = &cobra.Command{
	Use:     "list [team]:[channel]",
	Short:   "List channel groups",
	Long:    "Lists the groups associated with a channel",
	Example: "  group channel list myteam:mychannel",
	Args:    cobra.ExactArgs(1),
	RunE:    channelGroupListCmdF,
}
View Source
var ChannelGroupStatusCmd = &cobra.Command{
	Use:     "status [team]:[channel]",
	Short:   "Shows the group constraint status of the specified channel",
	Example: "  group channel status myteam:mychannel",
	Args:    cobra.ExactArgs(1),
	RunE:    channelGroupStatusCmdF,
}
View Source
var ChannelRenameCmd = &cobra.Command{
	Use:     "rename",
	Short:   "Rename a channel",
	Long:    `Rename a channel.`,
	Example: `"  channel rename myteam:mychannel newchannelname --display_name "New Display Name"`,
	Args:    cobra.MinimumNArgs(2),
	RunE:    renameChannelCmdF,
}
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:    createCommandCmdF,
}
View Source
var CommandDeleteCmd = &cobra.Command{
	Use:     "delete",
	Short:   "Delete a slash command",
	Long:    `Delete a slash command. Commands can be specified by command ID.`,
	Example: `  command delete commandID`,
	Args:    cobra.ExactArgs(1),
	RunE:    deleteCommandCmdF,
}
View Source
var CommandListCmd = &cobra.Command{
	Use:     "list",
	Short:   "List all commands on specified teams.",
	Long:    `List all commands on specified teams.`,
	Example: ` command list myteam`,
	RunE:    listCommandCmdF,
}
View Source
var CommandModifyCmd = &cobra.Command{
	Use:     "modify",
	Short:   "Modify a slash command",
	Long:    `Modify a slash command. Commands can be specified by command ID.`,
	Example: `  command modify commandID`,
	Args:    cobra.MinimumNArgs(1),
	RunE:    modifyCommandCmdF,
}
View Source
var CommandMoveCmd = &cobra.Command{
	Use:     "move",
	Short:   "Move a slash command to a different team",
	Long:    `Move a slash command to a different team. Commands can be specified by [team]:[command-trigger-word]. ie. myteam:trigger or by command ID.`,
	Example: `  command move newteam oldteam:command`,
	RunE:    moveCommandCmdF,
}
View Source
var CommandShowCmd = &cobra.Command{
	Use:     "show",
	Short:   "Show a custom slash command",
	Long:    `Show a custom slash command. Commands can be specified by command ID.`,
	Args:    cobra.ExactArgs(1),
	Example: `  command show commandID`,
	RunE:    showCommandCmdF,
}
View Source
var ConfigCmd = &cobra.Command{
	Use:   "config",
	Short: "Configuration",
}
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:    configGetCmdF,
}
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",
	RunE:    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",
	Args:    cobra.MinimumNArgs(2),
	RunE:    configSetCmdF,
}
View Source
var ConfigShowCmd = &cobra.Command{
	Use:     "show",
	Short:   "Writes the server configuration to STDOUT",
	Long:    "Pretty-prints the server configuration and writes to STDOUT",
	Example: "config show",
	RunE:    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.",
	Example: `  config subpath
  config subpath --path /mattermost
  config subpath --path /`,
	RunE: configSubpathCmdF,
}
View Source
var CsvExportCmd = &cobra.Command{
	Use:     "csv",
	Short:   "Export data from Mattermost in CSV format",
	Long:    "Export data from Mattermost in CSV format",
	Example: "export csv --exportFrom=12345",
	RunE:    buildExportCmdF("csv"),
}
View Source
var DbCmd = &cobra.Command{
	Use:   "db",
	Short: "Commands related to the database",
}
View Source
var DeleteAllUsersCmd = &cobra.Command{
	Use:     "deleteall",
	Short:   "Delete all users and all posts",
	Long:    "Permanently delete all users and all related information including posts.",
	Example: "  user deleteall",
	RunE:    deleteAllUsersCommandF,
}
View Source
var DeleteChannelsCmd = &cobra.Command{
	Use:   "delete [channels]",
	Short: "Delete channels",
	Long: `Permanently delete some channels.
Permanently deletes 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 delete myteam:mychannel",
	Args:    cobra.MinimumNArgs(1),
	RunE:    deleteChannelsCmdF,
}
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:    deleteTeamsCmdF,
}
View Source
var DeleteUserCmd = &cobra.Command{
	Use:     "delete [users]",
	Short:   "Delete users and all posts",
	Long:    "Permanently delete user and all related information including posts.",
	Example: "  user delete user@example.com",
	RunE:    deleteUserCmdF,
}
View Source
var ExportCmd = &cobra.Command{
	Use:   "export",
	Short: "Export data from Mattermost",
	Long:  "Export data from Mattermost in a format suitable for import into a third-party application or another Mattermost instance",
}
View Source
var ExportPermissionsCmd = &cobra.Command{
	Use:     "export",
	Short:   "Export permissions data",
	Long:    "Export Roles and Schemes to JSONL for use by Mattermost permissions import.",
	Example: " permissions export > export.jsonl",
	RunE:    exportPermissionsCmdF,
	PreRun: func(cmd *cobra.Command, args []string) {
		os.Setenv("MM_LOGSETTINGS_CONSOLELEVEL", "error")
	},
}
View Source
var GlobalRelayZipExportCmd = &cobra.Command{
	Use:     "global-relay-zip",
	Short:   "Export data from Mattermost into a zip file containing emails to send to Global Relay for debug and testing purposes only.",
	Long:    "Export data from Mattermost into a zip file containing emails to send to Global Relay for debug and testing purposes only. This does not archive any information in Global Relay.",
	Example: "export global-relay-zip --exportFrom=12345",
	RunE:    buildExportCmdF("globalrelay-zip"),
}
View Source
var GroupCmd = &cobra.Command{
	Use:   "group",
	Short: "Management of groups",
}
View Source
var ImportCmd = &cobra.Command{
	Use:   "import",
	Short: "Import data.",
}
View Source
var ImportPermissionsCmd = &cobra.Command{
	Use:     "import [file]",
	Short:   "Import permissions data",
	Long:    "Import Roles and Schemes JSONL data as created by the Mattermost permissions export.",
	Example: " permissions import export.jsonl",
	RunE:    importPermissionsCmdF,
}
View Source
var InitDbCmd = &cobra.Command{
	Use:   "init",
	Short: "Initialize the database",
	Long: `Initialize the database for a given DSN, executing the migrations and loading the custom defaults if any.

This command should be run using a database configuration DSN.`,
	Example: `  # you can use the config flag to pass the DSN
  $ mattermost db init --config postgres://localhost/mattermost

  # or you can use the MM_CONFIG environment variable
  $ MM_CONFIG=postgres://localhost/mattermost mattermost db init

  # and you can set a custom defaults file to be loaded into the database
  $ MM_CUSTOM_DEFAULTS_PATH=custom.json MM_CONFIG=postgres://localhost/mattermost mattermost db init`,
	Args: cobra.NoArgs,
	RunE: initDbCmdF,
}
View Source
var IntegrityCmd = &cobra.Command{
	Use:   "integrity",
	Short: "Check database data integrity",
	RunE:  integrityCmdF,
}
View Source
var JobserverCmd = &cobra.Command{
	Use:   "jobserver",
	Short: "Start the Mattermost job server",
	RunE:  jobserverCmdF,
}
View Source
var LdapCmd = &cobra.Command{
	Use:   "ldap",
	Short: "LDAP related utilities",
}
View Source
var LdapIdMigrate = &cobra.Command{
	Use:     "idmigrate",
	Short:   "Migrate LDAP IdAttribute to new value",
	Long:    "Migrate LDAP IdAttribute to new value. Run this utility then change the IdAttribute to the new value.",
	Example: " ldap idmigrate objectGUID",
	Args:    cobra.ExactArgs(1),
	RunE:    ldapIdMigrateCmdF,
}
View Source
var LdapSyncCmd = &cobra.Command{
	Use:     "sync",
	Short:   "Synchronize now",
	Long:    "Synchronize all LDAP users now.",
	Example: "  ldap sync",
	RunE:    ldapSyncCmdF,
}
View Source
var LicenseCmd = &cobra.Command{
	Use:   "license",
	Short: "Licensing commands",
}
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 are appended with ' (private)'.`,
	Example: "  channel list myteam",
	Args:    cobra.MinimumNArgs(1),
	RunE:    listChannelsCmdF,
}
View Source
var ListTeamsCmd = &cobra.Command{
	Use:     "list",
	Short:   "List all teams.",
	Long:    `List all teams on the server.`,
	Example: "  team list",
	RunE:    listTeamsCmdF,
}
View Source
var LogsCmd = &cobra.Command{
	Use:   "logs",
	Short: "Display logs in a human-readable format",
	RunE:  logsCmdF,
}
View Source
var MakeMemberCmd = &cobra.Command{
	Use:     "member [users]",
	Short:   "Remove system admin privileges",
	Long:    "Remove system admin privileges from some users.",
	Example: "  roles member user1",
	RunE:    makeMemberCmdF,
}
View Source
var MakeSystemAdminCmd = &cobra.Command{
	Use:     "system_admin [users]",
	Short:   "Set a user as system admin",
	Long:    "Make some users system admins",
	Example: "  roles system_admin user1",
	RunE:    makeSystemAdminCmdF,
}
View Source
var MigrateAuthCmd = &cobra.Command{
	Use:     "migrate_auth [from_auth] [to_auth] [migration-options]",
	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. See help text for details.")
			}
		}

		if toAuth == "saml" && !autoFlag {
			if len(args) != 3 {
				return errors.New("Saml migration requires three arguments when not using the --auto flag. See help text for details.")
			}
		}
		return nil
	},
	RunE: migrateAuthCmdF,
}
View Source
var MigrateConfigCmd = &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:    configMigrateCmdF,
}
View Source
var ModifyChannelCmd = &cobra.Command{
	Use:   "modify [channel] [flags] --username [user]",
	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 --username myusername",
	Args:    cobra.MinimumNArgs(1),
	RunE:    modifyChannelCmdF,
}
View Source
var ModifyTeamCmd = &cobra.Command{
	Use:     "modify [team] [flag]",
	Short:   "Modify a team's privacy setting to public or private",
	Long:    `Modify a team's privacy setting to public or private.`,
	Example: "  team modify myteam --private",
	Args:    cobra.ExactArgs(1),
	RunE:    modifyTeamCmdF,
}
View Source
var MoveChannelsCmd = &cobra.Command{
	Use:   "move [team] [channels] --username [user]",
	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 --username myusername",
	Args:    cobra.MinimumNArgs(2),
	RunE:    moveChannelsCmdF,
}
View Source
var PermissionsCmd = &cobra.Command{
	Use:   "permissions",
	Short: "Management of the Permissions system",
}
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:    pluginAddCmdF,
}
View Source
var PluginAddPublicKeyCmd = &cobra.Command{
	Use:     "add [keys]",
	Short:   "Adds public key(s)",
	Long:    "Adds public key(s) for plugins on your Mattermost server.",
	Example: `  plugin keys add my-pk-file1 my-pk-file2`,
	RunE:    pluginAddPublicKeyCmdF,
}
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:    pluginDeleteCmdF,
}
View Source
var PluginDeletePublicKeyCmd = &cobra.Command{
	Use:     "delete [keys]",
	Short:   "Deletes public key(s)",
	Long:    "Deletes public key(s) for plugins on your Mattermost server.",
	Example: `  plugin keys delete my-pk-file1 my-pk-file2`,
	RunE:    pluginDeletePublicKeyCmdF,
}
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:    pluginDisableCmdF,
}
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:    pluginEnableCmdF,
}
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:    pluginListCmdF,
}
View Source
var PluginPublicKeysCmd = &cobra.Command{
	Use:   "keys",
	Short: "List public keys",
	Long:  "List names of all public keys installed on your Mattermost server.",
	Example: `  plugin keys
  plugin keys --verbose`,
	RunE: pluginPublicKeysCmdF,
}
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`,
	RunE: removeChannelUsersCmdF,
}
View Source
var RemoveUsersCmd = &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:    removeUsersCmdF,
}
View Source
var ResetCmd = &cobra.Command{
	Use:   "reset",
	Short: "Reset the database to initial state",
	Long:  "Completely erases the database causing the loss of all data. This will reset Mattermost to its initial state.",
	RunE:  resetCmdF,
}
View Source
var ResetPermissionsCmd = &cobra.Command{
	Use:     "reset",
	Short:   "Reset the permissions system to its default state",
	Long:    "Reset the permissions system to its default state",
	Example: "  permissions reset",
	RunE:    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 login.`,
	Example: "  user resetmfa user@example.com",
	RunE:    resetUserMfaCmdF,
}
View Source
var ResetUserPasswordCmd = &cobra.Command{
	Use:     "password [user] [password]",
	Short:   "Set a user's password",
	Long:    "Set a user's password",
	Example: "  user password user@example.com Password1",
	RunE:    resetUserPasswordCmdF,
}
View Source
var RestoreChannelsCmd = &cobra.Command{
	Use:   "restore [channels]",
	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",
	Args:    cobra.MinimumNArgs(1),
	RunE:    restoreChannelsCmdF,
}
View Source
var RestoreTeamsCmd = &cobra.Command{
	Use:     "restore [teams]",
	Short:   "Restore some teams",
	Long:    `Restore a previously deleted team`,
	Example: "  team restore myteam",
	Args:    cobra.MinimumNArgs(1),
	RunE:    restoreTeamsCmdF,
}
View Source
var RolesCmd = &cobra.Command{
	Use:   "roles",
	Short: "Management of user roles",
}
View Source
var RootCmd = &cobra.Command{
	Use:   "mattermost",
	Short: "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`,
}
View Source
var RunServerForWebClientTestsCmd = &cobra.Command{
	Use:   "web_client_tests_server",
	Short: "Run the server configured for running the web client tests against it",
	RunE:  serverForWebClientTestsCmdF,
}
View Source
var RunWebClientTestsCmd = &cobra.Command{
	Use:   "web_client_tests",
	Short: "Run the web client tests",
	RunE:  webClientTestsCmdF,
}
View Source
var SampleDataCmd = &cobra.Command{
	Use:   "sampledata",
	Short: "Generate sample data",
	RunE:  sampleDataCmdF,
}
View Source
var ScheduleExportCmd = &cobra.Command{
	Use:     "schedule",
	Short:   "Schedule an export data job in Mattermost",
	Long:    "Schedule an export data job in Mattermost (this will run asynchronously via a background worker)",
	Example: "export schedule --format=actiance --exportFrom=12345 --timeoutSeconds=12345",
	RunE:    scheduleExportCmdF,
}
View Source
var SearchChannelCmd = &cobra.Command{
	Use:   "search [channel]\n  mattermost 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: 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:    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:    searchUserCmdF,
}
View Source
var SlackImportCmd = &cobra.Command{
	Use:     "slack [team] [file]",
	Short:   "Import a team from Slack.",
	Long:    "Import a team from a Slack export zip file.",
	Example: "  import slack myteam slack_export.zip",
	RunE:    slackImportCmdF,
}
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: 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 constraint on the specified team",
	Example: "  group team disable myteam",
	Args:    cobra.ExactArgs(1),
	RunE:    teamGroupDisableCmdF,
}
View Source
var TeamGroupEnableCmd = &cobra.Command{
	Use:     "enable [team]",
	Short:   "Enables group constraint on the specified team",
	Example: "  group team enable myteam",
	Args:    cobra.ExactArgs(1),
	RunE:    teamGroupEnableCmdF,
}
View Source
var TeamGroupListCmd = &cobra.Command{
	Use:     "list [team]",
	Short:   "List team groups",
	Long:    "Lists the groups associated with a team",
	Example: "  group team list myteam",
	Args:    cobra.ExactArgs(1),
	RunE:    teamGroupListCmdF,
}
View Source
var TeamGroupStatusCmd = &cobra.Command{
	Use:     "status [team]",
	Short:   "Shows the group constraint status of the specified team",
	Example: "  group team status myteam",
	Args:    cobra.ExactArgs(1),
	RunE:    teamGroupStatusCmdF,
}
View Source
var TeamRenameCmd = &cobra.Command{
	Use:   "rename",
	Short: "Rename a team",
	Long:  `Rename a team.`,
	Example: `  team rename myteam newteamname --display_name "My New Team Name"
	team rename myteam - --display_name "My New Team Name"`,
	Args: cobra.MinimumNArgs(2),
	RunE: renameTeamCmdF,
}
View Source
var TestCmd = &cobra.Command{
	Use:    "test",
	Short:  "Testing Commands",
	Hidden: true,
}
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:    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: userActivateCmdF,
}
View Source
var UserCmd = &cobra.Command{
	Use:   "user",
	Short: "Management of users",
}
View Source
var UserConvertCmd = &cobra.Command{
	Use:   "convert [emails, usernames, userIds] --bot",
	Short: "Convert users to bots, or a bot to a user",
	Long:  "Convert users to bots, or a bot to a user",
	Example: `  user convert user@example.com anotherUser --bot
	user convert botusername --email new.email@email.com --password password --user`,
	Args: cobra.MinimumNArgs(1),
	RunE: userConvertCmdF,
}
View Source
var UserCreateCmd = &cobra.Command{
	Use:     "create",
	Short:   "Create a user",
	Long:    "Create a user",
	Example: `  user create --email user@example.com --username userexample --password Password1`,
	RunE:    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: userDeactivateCmdF,
}
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: userInviteCmdF,
}
View Source
var ValidateConfigCmd = &cobra.Command{
	Use:   "validate",
	Short: "Validate config file",
	Long:  "If the config file is valid, this command will output a success message and have a zero exit code. If it is invalid, this command will output an error and have a non-zero exit code.",
	RunE:  configValidateCmdF,
}
View Source
var VerifyUserCmd = &cobra.Command{
	Use:     "verify [users]",
	Short:   "Verify email of users",
	Long:    "Verify the emails of some users.",
	Example: "  user verify user1",
	RunE:    verifyUserCmdF,
}
View Source
var VersionCmd = &cobra.Command{
	Use:   "version",
	Short: "Display version information",
	RunE:  versionCmdF,
}
View Source
var WebhookCmd = &cobra.Command{
	Use:   "webhook",
	Short: "Management of webhooks",
}
View Source
var WebhookCreateIncomingCmd = &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:    createIncomingWebhookCmdF,
}
View Source
var WebhookCreateOutgoingCmd = &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: createOutgoingWebhookCmdF,
}
View Source
var WebhookDeleteCmd = &cobra.Command{
	Use:     "delete",
	Short:   "Delete webhooks",
	Long:    "Delete webhook with given id",
	Example: "  webhook delete [webhookID]",
	RunE:    deleteWebhookCmdF,
}
View Source
var WebhookListCmd = &cobra.Command{
	Use:     "list",
	Short:   "List webhooks",
	Long:    "list all webhooks",
	Example: "  webhook list myteam",
	RunE:    listWebhookCmdF,
}
View Source
var WebhookModifyIncomingCmd = &cobra.Command{
	Use:     "modify-incoming",
	Short:   "Modify incoming webhook",
	Long:    "Modify existing incoming webhook by changing its title, description, channel or icon url",
	Example: "  webhook modify-incoming [webhookID] --channel [channelID] --display-name [displayName] --description [webhookDescription] --lock-to-channel --icon [iconURL]",
	RunE:    modifyIncomingWebhookCmdF,
}
View Source
var WebhookModifyOutgoingCmd = &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",
	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:    modifyOutgoingWebhookCmdF,
}
View Source
var WebhookMoveOutgoingCmd = &cobra.Command{
	Use:     "move-outgoing",
	Short:   "Move outgoing webhook",
	Long:    "Move outgoing webhook with an id",
	Example: "  webhook move-outgoing newteam oldteam:webhook-id --channel new-default-channel",
	Args:    cobra.ExactArgs(2),
	RunE:    moveOutgoingWebhookCmd,
}
View Source
var WebhookShowCmd = &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:    showWebhookCmdF,
}

Functions

func CommandPrettyPrintln

func CommandPrettyPrintln(a ...interface{}) (int, error)

func CommandPrintErrorln

func CommandPrintErrorln(a ...interface{}) (int, error)

func CommandPrintln

func CommandPrintln(a ...interface{}) (int, error)

func InitDBCommandContextCobra

func InitDBCommandContextCobra(command *cobra.Command) (*app.App, error)

func InitDBCommandContextCobraReadWrite

func InitDBCommandContextCobraReadWrite(command *cobra.Command) (*app.App, error)

func Run

func Run(args []string) error

func Setup

func Setup(t testing.TB) *testHelper

Setup creates an instance of testHelper.

func SetupWithStoreMock

func SetupWithStoreMock(t testing.TB) *testHelper

Setup creates an instance of testHelper.

func UpdateMap

func UpdateMap(configMap map[string]interface{}, configSettings []string, newVal []string) error

Types

type Command

type Command = cobra.Command

Jump to

Keyboard shortcuts

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