commands

package
v0.0.0-...-c4eee4d Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: AGPL-3.0 Imports: 52 Imported by: 0

Documentation

Overview

Package commands provides the CLI commands of PhotoPrism.

Copyright (c) 2018 - 2024 PhotoPrism UG. All rights reserved.

This program is free software: you can redistribute it and/or modify
it under Version 3 of the GNU Affero General Public License (the "AGPL"):
<https://docs.photoprism.app/license/agpl>

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

The AGPL is supplemented by our Trademark and Brand Guidelines,
which describe how our Brand Assets may be used:
<https://www.photoprism.app/trademark>

Feel free to send an email to hello@photoprism.app if you have questions, want to support our work, or just want to say hello.

Additional information can be found in our Developer Guide: <https://docs.photoprism.app/developer-guide/>

Index

Constants

View Source
const (
	ClientIdUsage          = "static client `UID` for test purposes"
	ClientSecretUsage      = "static client `SECRET` for test purposes"
	ClientNameUsage        = "`CLIENT` name to help identify the application"
	ClientRoleUsage        = "client authorization `ROLE`"
	ClientAuthScope        = "client authorization `SCOPES` e.g. \"metrics\" or \"photos albums\" (\"*\" to allow all)"
	ClientAuthProvider     = "client authentication `PROVIDER`"
	ClientAuthMethod       = "client authentication `METHOD`"
	ClientAuthExpires      = "access token `LIFETIME` in seconds, after which a new token must be requested"
	ClientAuthTokens       = "maximum `NUMBER` of access tokens that the client can request (-1 to disable the limit)"
	ClientRegenerateSecret = "set a new randomly generated client secret"
	ClientEnable           = "enable client authentication if disabled"
	ClientDisable          = "disable client authentication"
	ClientSecretInfo       = "\nPLEASE WRITE DOWN THE %s CLIENT SECRET, AS YOU WILL NOT BE ABLE TO SEE IT AGAIN:\n"
)

Usage hints for the client management subcommands.

View Source
const (
	UserNameUsage     = "full `NAME` for display in the interface"
	UserEmailUsage    = "unique `EMAIL` address of the user"
	UserPasswordUsage = "`PASSWORD` for local authentication"
	UserRoleUsage     = "user role `NAME` (leave blank for default)"
	UserAdminUsage    = "make user super admin with full access"
	UserNoLoginUsage  = "disable login on the web interface"
	UserWebDAVUsage   = "allow to sync files via WebDAV"
	UserDisable2FA    = "deactivate two-factor authentication"
)

Usage hints for the user management subcommands.

Variables

View Source
var AuthAddCommand = cli.Command{
	Name:  "add",
	Usage: "Adds a new authentication secret for client applications",
	Description: "If you specify a username as argument, an app password will be created for this user account." +
		" It can be used as a password replacement to grant limited access to client applications.",
	ArgsUsage: "[username]",
	Flags:     AuthAddFlags,
	Action:    authAddAction,
}

AuthAddCommand configures the command name, flags, and action.

View Source
var AuthAddFlags = []cli.Flag{
	cli.StringFlag{
		Name:  "name, n",
		Usage: "`CLIENT` name to help identify the application",
	},
	cli.StringFlag{
		Name:  "scope, s",
		Usage: "authorization `SCOPES` e.g. \"metrics\" or \"photos albums\" (\"*\" to allow all)",
	},
	cli.Int64Flag{
		Name:  "expires, e",
		Usage: "authentication `LIFETIME` in seconds, after which access expires (-1 to disable the limit)",
		Value: unix.Year,
	},
}

AuthAddFlags specifies the "photoprism auth add" command flags.

View Source
var AuthCommands = cli.Command{
	Name:    "auth",
	Aliases: []string{"sess"},
	Usage:   "API authentication subcommands",
	Subcommands: []cli.Command{
		AuthListCommand,
		AuthAddCommand,
		AuthShowCommand,
		AuthRemoveCommand,
		AuthResetCommand,
	},
}

AuthCommands registers the API authentication subcommands.

View Source
var AuthListCommand = cli.Command{
	Name:      "ls",
	Usage:     "Lists currently authenticated users and clients",
	ArgsUsage: "[search]",
	Flags:     append(report.CliFlags, countFlag, tokensFlag),
	Action:    authListAction,
}

AuthListCommand configures the command name, flags, and action.

View Source
var AuthRemoveCommand = cli.Command{
	Name:      "rm",
	Usage:     "Deletes a session by id or access token",
	ArgsUsage: "[identifier]",
	Action:    authRemoveAction,
}

AuthRemoveCommand configures the command name, flags, and action.

View Source
var AuthResetCommand = cli.Command{
	Name:  "reset",
	Usage: "Resets the authentication of all users and clients",
	Flags: []cli.Flag{
		cli.BoolFlag{
			Name:  "trace, t",
			Usage: "show trace logs for debugging",
		},
		cli.BoolFlag{
			Name:  "yes, y",
			Usage: "assume \"yes\" and run non-interactively",
		},
	},
	Action: authResetAction,
}

AuthResetCommand configures the command name, flags, and action.

View Source
var AuthShowCommand = cli.Command{
	Name:      "show",
	Usage:     "Shows detailed information about a session",
	ArgsUsage: "[identifier]",
	Flags:     report.CliFlags,
	Action:    authShowAction,
}

AuthShowCommand configures the command name, flags, and action.

View Source
var BackupCommand = cli.Command{
	Name:        "backup",
	Description: backupDescription,
	Usage:       "Creates an index backup and optionally album YAML files organized by type",
	ArgsUsage:   "[filename]",
	Flags:       backupFlags,
	Action:      backupAction,
}

BackupCommand configures the command name, flags, and action.

View Source
var CleanUpCommand = cli.Command{
	Name:   "cleanup",
	Usage:  "Removes orphaned index entries, sidecar and thumbnail files",
	Flags:  cleanUpFlags,
	Action: cleanUpAction,
}

CleanUpCommand configures the command name, flags, and action.

View Source
var ClientAddFlags = []cli.Flag{
	cli.StringFlag{
		Name:   "id",
		Usage:  ClientIdUsage,
		Hidden: true,
	},
	cli.StringFlag{
		Name:  "name, n",
		Usage: ClientNameUsage,
	},
	cli.StringFlag{
		Name:  "role, r",
		Usage: ClientRoleUsage,
		Value: acl.RoleClient.String(),
	},
	cli.StringFlag{
		Name:  "scope, s",
		Usage: ClientAuthScope,
	},
	cli.StringFlag{
		Name:   "provider, p",
		Usage:  ClientAuthProvider,
		Value:  authn.ProviderClient.String(),
		Hidden: true,
	},
	cli.StringFlag{
		Name:   "method, m",
		Usage:  ClientAuthMethod,
		Value:  authn.MethodOAuth2.String(),
		Hidden: true,
	},
	cli.Int64Flag{
		Name:  "expires, e",
		Usage: ClientAuthExpires,
		Value: unix.Day,
	},
	cli.Int64Flag{
		Name:  "tokens, t",
		Usage: ClientAuthTokens,
		Value: 10,
	},
	cli.StringFlag{
		Name:   "secret",
		Usage:  ClientSecretUsage,
		Hidden: true,
	},
}

ClientAddFlags specifies the "photoprism client add" command flags.

View Source
var ClientModFlags = []cli.Flag{
	cli.StringFlag{
		Name:  "name, n",
		Usage: ClientNameUsage,
	},
	cli.StringFlag{
		Name:  "role, r",
		Usage: ClientRoleUsage,
		Value: acl.RoleClient.String(),
	},
	cli.StringFlag{
		Name:  "scope, s",
		Usage: ClientAuthScope,
	},
	cli.StringFlag{
		Name:   "provider, p",
		Usage:  ClientAuthProvider,
		Value:  authn.ProviderClient.String(),
		Hidden: true,
	},
	cli.StringFlag{
		Name:   "method, m",
		Usage:  ClientAuthMethod,
		Value:  authn.MethodOAuth2.String(),
		Hidden: true,
	},
	cli.Int64Flag{
		Name:  "expires, e",
		Usage: ClientAuthExpires,
		Value: unix.Day,
	},
	cli.Int64Flag{
		Name:  "tokens, t",
		Usage: ClientAuthTokens,
		Value: 10,
	},
	cli.StringFlag{
		Name:   "secret",
		Usage:  ClientSecretUsage,
		Hidden: true,
	},
	cli.BoolFlag{
		Name:  "regenerate",
		Usage: ClientRegenerateSecret,
	},
	cli.BoolFlag{
		Name:  "enable",
		Usage: ClientEnable,
	},
	cli.BoolFlag{
		Name:  "disable",
		Usage: ClientDisable,
	},
}

ClientModFlags specifies the "photoprism client mod" command flags.

View Source
var ClientsAddCommand = cli.Command{
	Name:        "add",
	Usage:       "Registers a new client application",
	Description: "If you specify a username as argument, the new client will belong to this user and inherit its privileges.",
	ArgsUsage:   "[username]",
	Flags:       ClientAddFlags,
	Action:      clientsAddAction,
}

ClientsAddCommand configures the command name, flags, and action.

View Source
var ClientsCommands = cli.Command{
	Name:    "clients",
	Aliases: []string{"client"},
	Usage:   "Client credentials subcommands",
	Subcommands: []cli.Command{
		ClientsListCommand,
		ClientsAddCommand,
		ClientsShowCommand,
		ClientsModCommand,
		ClientsRemoveCommand,
		ClientsResetCommand,
	},
}

ClientsCommands configures the client application subcommands.

View Source
var ClientsListCommand = cli.Command{
	Name:      "ls",
	Usage:     "Lists registered client applications",
	ArgsUsage: "[search]",
	Flags:     append(report.CliFlags, countFlag),
	Action:    clientsListAction,
}

ClientsListCommand configures the command name, flags, and action.

View Source
var ClientsModCommand = cli.Command{
	Name:      "mod",
	Usage:     "Updates client application settings",
	ArgsUsage: "[client id]",
	Flags:     ClientModFlags,
	Action:    clientsModAction,
}

ClientsModCommand configures the command name, flags, and action.

View Source
var ClientsRemoveCommand = cli.Command{
	Name:      "rm",
	Usage:     "Deletes the specified client application",
	ArgsUsage: "[client id]",
	Flags: []cli.Flag{
		cli.BoolFlag{
			Name:  "force, f",
			Usage: "don't ask for confirmation",
		},
	},
	Action: clientsRemoveAction,
}

ClientsRemoveCommand configures the command name, flags, and action.

View Source
var ClientsResetCommand = cli.Command{
	Name:  "reset",
	Usage: "Removes all registered client applications",
	Flags: []cli.Flag{
		cli.BoolFlag{
			Name:  "trace, t",
			Usage: "show trace logs for debugging",
		},
		cli.BoolFlag{
			Name:  "yes, y",
			Usage: "assume \"yes\" and run non-interactively",
		},
	},
	Action: clientsResetAction,
}

ClientsResetCommand configures the command name, flags, and action.

View Source
var ClientsShowCommand = cli.Command{
	Name:      "show",
	Usage:     "Shows client configuration details",
	ArgsUsage: "[client id]",
	Flags:     report.CliFlags,
	Action:    clientsShowAction,
}

ClientsShowCommand configures the command name, flags, and action.

View Source
var ConfigReports = []Report{
	{Title: "Global Config Options", NoWrap: true, Report: func(conf *config.Config) ([][]string, []string) {
		return conf.Report()
	}},
}

ConfigReports specifies which configuration reports to display.

View Source
var ConnectCommand = cli.Command{
	Name:      "connect",
	Usage:     "Connects your membership account",
	ArgsUsage: "[activation code]",
	Action:    connectAction,
}

ConnectCommand configures the command name, flags, and action.

View Source
var ConvertCommand = cli.Command{
	Name:      "convert",
	Usage:     "Converts files in other formats to JPEG and AVC as needed",
	ArgsUsage: "[subfolder]",
	Flags: []cli.Flag{
		cli.StringSliceFlag{
			Name:  "ext, e",
			Usage: "only process files with the specified extensions, e.g. mp4",
		},
		cli.BoolFlag{
			Name:  "force, f",
			Usage: "replace existing JPEG files in the sidecar folder",
		},
	},
	Action: convertAction,
}

ConvertCommand configures the command name, flags, and action.

View Source
var CopyCommand = cli.Command{
	Name:      "cp",
	Aliases:   []string{"copy"},
	Usage:     "Copies media files to originals",
	ArgsUsage: "[source]",
	Flags: []cli.Flag{
		cli.StringFlag{
			Name:  "dest, d",
			Usage: "relative originals `PATH` to which the files should be imported",
		},
	},
	Action: copyAction,
}

CopyCommand configures the command name, flags, and action.

View Source
var FacesCommands = cli.Command{
	Name:  "faces",
	Usage: "Face recognition subcommands",
	Subcommands: []cli.Command{
		{
			Name:   "stats",
			Usage:  "Shows stats on face samples",
			Action: facesStatsAction,
		},
		{
			Name:  "audit",
			Usage: "Scans the index for issues",
			Flags: []cli.Flag{
				cli.BoolFlag{
					Name:  "fix, f",
					Usage: "fix discovered issues",
				},
			},
			Action: facesAuditAction,
		},
		{
			Name:  "reset",
			Usage: "Removes people and faces after confirmation",
			Flags: []cli.Flag{
				cli.BoolFlag{
					Name:  "force, f",
					Usage: "remove all people and faces",
				},
			},
			Action: facesResetAction,
		},
		{
			Name:      "index",
			Usage:     "Searches originals for faces",
			ArgsUsage: "[subfolder]",
			Action:    facesIndexAction,
		},
		{
			Name:  "update",
			Usage: "Performs face clustering and matching",
			Flags: []cli.Flag{
				cli.BoolFlag{
					Name:  "force, f",
					Usage: "update all faces",
				},
			},
			Action: facesUpdateAction,
		},
		{
			Name:   "optimize",
			Usage:  "Optimizes face clusters",
			Action: facesOptimizeAction,
		},
	},
}

FacesCommands configures the command name, flags, and action.

View Source
var FindCommand = cli.Command{
	Name:      "find",
	Usage:     "Searches the index for specific files",
	ArgsUsage: "filter",
	Flags: append(report.CliFlags, cli.UintFlag{
		Name:  "n",
		Usage: "maximum number of search `RESULTS`",
		Value: 10000,
	}),
	Action: findAction,
}

FindCommand configures the command name, flags, and action.

View Source
var ImportCommand = cli.Command{
	Name:      "mv",
	Aliases:   []string{"import"},
	Usage:     "Moves media files to originals",
	ArgsUsage: "[source]",
	Flags: []cli.Flag{
		cli.StringFlag{
			Name:  "dest, d",
			Usage: "relative originals `PATH` to which the files should be imported",
		},
	},
	Action: importAction,
}

ImportCommand configures the command name, flags, and action.

View Source
var IndexCommand = cli.Command{
	Name:      "index",
	Usage:     "Indexes original media files",
	ArgsUsage: "[subfolder]",
	Flags:     indexFlags,
	Action:    indexAction,
}

IndexCommand registers the index cli command.

View Source
var InitConfig = func(ctx *cli.Context) (*config.Config, error) {
	c := config.NewConfig(ctx)
	get.SetConfig(c)
	return c, c.Init()
}

InitConfig initializes the command config.

View Source
var MigrateCommand = cli.Command{
	Name:      "migrate",
	Usage:     MigrationsRunCommand.Usage,
	ArgsUsage: MigrationsRunCommand.ArgsUsage,
	Flags:     MigrationsRunCommand.Flags,
	Action:    migrationsRunAction,
}

MigrateCommand configures the command name, flags, and action.

View Source
var MigrationsCommands = cli.Command{
	Name:  "migrations",
	Usage: "Database schema migration subcommands",
	Subcommands: []cli.Command{
		MigrationsStatusCommand,
		MigrationsRunCommand,
	},
}

MigrationsCommands registers the "migrations" CLI command.

View Source
var MigrationsRunCommand = cli.Command{
	Name:      "run",
	Aliases:   []string{"execute", "migrate"},
	Usage:     "Executes database schema migrations",
	ArgsUsage: "[migrations...]",
	Flags: []cli.Flag{
		cli.BoolFlag{
			Name:  "failed, f",
			Usage: "run previously failed migrations",
		},
		cli.BoolFlag{
			Name:  "trace, t",
			Usage: "show trace logs for debugging",
		},
	},
	Action: migrationsRunAction,
}
View Source
var MigrationsStatusCommand = cli.Command{
	Name:      "ls",
	Aliases:   []string{"status", "show"},
	Usage:     "Displays the status of schema migrations",
	ArgsUsage: "[migrations...]",
	Flags:     report.CliFlags,
	Action:    migrationsStatusAction,
}
View Source
var MomentsCommand = cli.Command{
	Name:   "moments",
	Usage:  "Creates albums of special moments, trips, and places",
	Action: momentsAction,
}

MomentsCommand configures the command name, flags, and action.

View Source
var OptimizeCommand = cli.Command{
	Name:  "optimize",
	Usage: "Maintains titles, estimates, and other metadata",
	Flags: []cli.Flag{
		cli.BoolFlag{
			Name:  "force, f",
			Usage: "update all, including recently optimized",
		},
	},
	Action: optimizeAction,
}

OptimizeCommand configures the command name, flags, and action.

View Source
var PasswdCommand = cli.Command{
	Name:      "passwd",
	Usage:     "Changes the password of a registered user",
	ArgsUsage: "[username]",
	Flags: []cli.Flag{
		cli.BoolFlag{
			Name:  "show, s",
			Usage: "show bcrypt password hash",
		},
	},
	Action: passwdAction,
}

PasswdCommand configures the command name, flags, and action.

PhotoPrism contains the photoprism CLI (sub-)commands.

View Source
var PlacesCommands = cli.Command{
	Name:  "places",
	Usage: "Maps and location details subcommands",
	Subcommands: []cli.Command{
		{
			Name:  "update",
			Usage: "Retrieves updated location details",
			Flags: []cli.Flag{
				cli.BoolFlag{
					Name:   "yes, y",
					Hidden: true,
					Usage:  "assume \"yes\" as answer to all prompts and run non-interactively",
				},
			},
			Action: placesUpdateAction,
		},
	},
}

PlacesCommands configures the command name, flags, and action.

View Source
var PurgeCommand = cli.Command{
	Name:   "purge",
	Usage:  "Updates missing files, photo counts, and album covers",
	Flags:  purgeFlags,
	Action: purgeAction,
}

PurgeCommand configures the command name, flags, and action.

View Source
var ResetCommand = cli.Command{
	Name:  "reset",
	Usage: "Resets the index, clears the cache, and removes sidecar files",
	Flags: []cli.Flag{
		cli.BoolFlag{
			Name:  "index, i",
			Usage: "reset index database only",
		},
		cli.BoolFlag{
			Name:  "trace, t",
			Usage: "show trace logs for debugging",
		},
		cli.BoolFlag{
			Name:  "yes, y",
			Usage: "assume \"yes\" and run non-interactively",
		},
	},
	Action: resetAction,
}

ResetCommand configures the command name, flags, and action.

View Source
var RestoreCommand = cli.Command{
	Name:        "restore",
	Description: restoreDescription,
	Usage:       "Restores the index from a backup and optionally albums from YAML files",
	ArgsUsage:   "[filename]",
	Flags:       restoreFlags,
	Action:      restoreAction,
}

RestoreCommand configures the command name, flags, and action.

View Source
var ShowCommands = cli.Command{
	Name:  "show",
	Usage: "Shows supported formats, features, and config options",
	Subcommands: []cli.Command{
		ShowConfigCommand,
		ShowConfigOptionsCommand,
		ShowConfigYamlCommand,
		ShowSearchFiltersCommand,
		ShowFileFormatsCommand,
		ShowThumbSizesCommand,
		ShowVideoSizesCommand,
		ShowMetadataCommand,
	},
}

ShowCommands configures the show subcommands.

View Source
var ShowConfigCommand = cli.Command{
	Name:   "config",
	Usage:  "Displays global config options and their current values",
	Flags:  report.CliFlags,
	Action: showConfigAction,
}

ShowConfigCommand configures the command name, flags, and action.

View Source
var ShowConfigOptionsCommand = cli.Command{
	Name:   "config-options",
	Usage:  "Displays supported environment variables and CLI flags",
	Flags:  report.CliFlags,
	Action: showConfigOptionsAction,
}

ShowConfigOptionsCommand configures the command name, flags, and action.

View Source
var ShowConfigYamlCommand = cli.Command{
	Name:   "config-yaml",
	Usage:  "Displays supported YAML config options and CLI flags",
	Flags:  report.CliFlags,
	Action: showConfigYamlAction,
}

ShowConfigYamlCommand configures the command name, flags, and action.

View Source
var ShowFileFormatsCommand = cli.Command{
	Name:  "file-formats",
	Usage: "Displays supported media and sidecar file formats",
	Flags: append(report.CliFlags, cli.BoolFlag{
		Name:  "short, s",
		Usage: "hide format descriptions",
	}),
	Action: showFileFormatsAction,
}

ShowFileFormatsCommand configures the command name, flags, and action.

View Source
var ShowMetadataCommand = cli.Command{
	Name:  "metadata",
	Usage: "Displays supported metadata tags and standards",
	Flags: append(report.CliFlags, cli.BoolFlag{
		Name:  "short, s",
		Usage: "hide links to documentation",
	}),
	Action: showMetadataAction,
}

ShowMetadataCommand configures the command name, flags, and action.

View Source
var ShowSearchFiltersCommand = cli.Command{
	Name:   "search-filters",
	Usage:  "Displays supported search filters with examples",
	Flags:  report.CliFlags,
	Action: showSearchFiltersAction,
}

ShowSearchFiltersCommand configures the command name, flags, and action.

View Source
var ShowThumbSizesCommand = cli.Command{
	Name:   "thumb-sizes",
	Usage:  "Displays supported standard thumbnail sizes",
	Flags:  report.CliFlags,
	Action: showThumbSizesAction,
}

ShowThumbSizesCommand configures the command name, flags, and action.

View Source
var ShowVideoSizesCommand = cli.Command{
	Name:   "video-sizes",
	Usage:  "Displays supported standard video sizes",
	Flags:  report.CliFlags,
	Action: showVideoSizesAction,
}

ShowVideoSizesCommand configures the command name, flags, and action.

View Source
var StartCommand = cli.Command{
	Name:    "start",
	Aliases: []string{"up"},
	Usage:   "Starts the Web server",
	Flags:   startFlags,
	Action:  startAction,
}

StartCommand configures the command name, flags, and action.

View Source
var StatusCommand = cli.Command{
	Name:   "status",
	Usage:  "Checks if the Web server is running",
	Action: statusAction,
}

StatusCommand configures the command name, flags, and action.

View Source
var StopCommand = cli.Command{
	Name:    "stop",
	Aliases: []string{"down"},
	Usage:   "Stops the Web server in daemon mode",
	Action:  stopAction,
}

StopCommand configures the command name, flags, and action.

View Source
var ThumbsCommand = cli.Command{
	Name:      "thumbs",
	Usage:     "Generates thumbnails using the current settings",
	ArgsUsage: "[subfolder]",
	Flags: []cli.Flag{
		cli.BoolFlag{
			Name:  "force, f",
			Usage: "replace existing thumbnail files",
		},
		cli.BoolFlag{
			Name:  "originals, o",
			Usage: "scan originals only, skip sidecar folder",
		},
	},
	Action: thumbsAction,
}

ThumbsCommand configures the command name, flags, and action.

View Source
var UserFlags = []cli.Flag{
	cli.StringFlag{
		Name:  "name, n",
		Usage: UserNameUsage,
	},
	cli.StringFlag{
		Name:  "email, m",
		Usage: UserEmailUsage,
	},
	cli.StringFlag{
		Name:  "password, p",
		Usage: UserPasswordUsage,
	},
	cli.StringFlag{
		Name:  "role, r",
		Usage: UserRoleUsage,
		Value: acl.RoleAdmin.String(),
	},
	cli.BoolFlag{
		Name:  "superadmin, s",
		Usage: UserAdminUsage,
	},
	cli.BoolFlag{
		Name:  "no-login, l",
		Usage: UserNoLoginUsage,
	},
	cli.BoolFlag{
		Name:  "webdav, w",
		Usage: UserWebDAVUsage,
	},
}

UserFlags specifies the add and modify user command flags.

View Source
var UsersAddCommand = cli.Command{
	Name:      "add",
	Usage:     "Creates a new user account",
	ArgsUsage: "[username]",
	Flags:     UserFlags,
	Action:    usersAddAction,
}

UsersAddCommand configures the command name, flags, and action.

View Source
var UsersCommands = cli.Command{
	Name:    "users",
	Aliases: []string{"user"},
	Usage:   "User management subcommands",
	Subcommands: []cli.Command{
		UsersListCommand,
		UsersLegacyCommand,
		UsersAddCommand,
		UsersShowCommand,
		UsersModCommand,
		UsersRemoveCommand,
		UsersResetCommand,
	},
}

UsersCommands configures the user management subcommands.

View Source
var UsersLegacyCommand = cli.Command{
	Name:      "legacy",
	Usage:     "Lists legacy user accounts",
	ArgsUsage: "[search]",
	Flags:     report.CliFlags,
	Action:    usersLegacyAction,
}

UsersLegacyCommand configures the command name, flags, and action.

View Source
var UsersListCommand = cli.Command{
	Name:   "ls",
	Usage:  "Lists registered user accounts",
	Flags:  append(report.CliFlags, countFlag),
	Action: usersListAction,
}

UsersListCommand configures the command name, flags, and action.

View Source
var UsersModCommand = cli.Command{
	Name:      "mod",
	Usage:     "Changes user account settings",
	ArgsUsage: "[username]",
	Flags: append(UserFlags, cli.BoolFlag{
		Name:  "disable-2fa",
		Usage: UserDisable2FA,
	}),
	Action: usersModAction,
}

UsersModCommand configures the command name, flags, and action.

View Source
var UsersRemoveCommand = cli.Command{
	Name:      "rm",
	Usage:     "Deletes a registered user account",
	ArgsUsage: "[username]",
	Flags: []cli.Flag{
		cli.BoolFlag{
			Name:  "force, f",
			Usage: "don't ask for confirmation",
		},
	},
	Action: usersRemoveAction,
}

UsersRemoveCommand configures the command name, flags, and action.

View Source
var UsersResetCommand = cli.Command{
	Name:  "reset",
	Usage: "Removes all registered user accounts",
	Flags: []cli.Flag{
		cli.BoolFlag{
			Name:  "trace, t",
			Usage: "show trace logs for debugging",
		},
		cli.BoolFlag{
			Name:  "yes, y",
			Usage: "assume \"yes\" and run non-interactively",
		},
	},
	Action: usersResetAction,
}

UsersResetCommand configures the command name, flags, and action.

View Source
var UsersShowCommand = cli.Command{
	Name:      "show",
	Usage:     "Shows detailed account information",
	ArgsUsage: "[username]",
	Flags:     report.CliFlags,
	Action:    usersShowAction,
}

UsersShowCommand configures the command name, flags, and action.

View Source
var VersionCommand = cli.Command{
	Name:   "version",
	Usage:  "Shows version information",
	Action: versionAction,
}

VersionCommand configures the command name, flags, and action.

Functions

func CallWithDependencies

func CallWithDependencies(ctx *cli.Context, action func(conf *config.Config) error) (err error)

CallWithDependencies calls a command action with initialized dependencies.

func LogErr

func LogErr(err error)

LogErr logs an error if the argument is not nil.

Types

type Report

type Report struct {
	Title  string
	NoWrap bool
	Report func(*config.Config) ([][]string, []string)
}

Report represents a report table with title and options.

Jump to

Keyboard shortcuts

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