gitea: code.gitea.io/gitea/cmd Index | Files

package cmd

import "code.gitea.io/gitea/cmd"

Package cmd provides subcommands to the gitea binary - such as "web" or "admin".

Index

Package Files

admin.go admin_auth_ldap.go cert.go cmd.go convert.go docs.go doctor.go dump.go dump_repo.go embedded_stub.go generate.go hook.go keys.go mailer.go manager.go migrate.go migrate_storage.go restore_repo.go serv.go web.go web_graceful.go

Variables

var (
    // CmdAdmin represents the available admin sub-command.
    CmdAdmin = cli.Command{
        Name:  "admin",
        Usage: "Command line interface to perform common administrative operations",
        Subcommands: []cli.Command{
            subcmdUser,
            subcmdRepoSyncReleases,
            subcmdRegenerate,
            subcmdAuth,
            subcmdSendMail,
        },
    }
)
var CmdCert = cli.Command{
    Name:        "cert",
    Usage:       "Generate self-signed certificate",
    Description: "" /* 131 byte string literal not displayed */,

    Action: runCert,
    Flags: []cli.Flag{
        cli.StringFlag{
            Name:  "host",
            Value: "",
            Usage: "Comma-separated hostnames and IPs to generate a certificate for",
        },
        cli.StringFlag{
            Name:  "ecdsa-curve",
            Value: "",
            Usage: "ECDSA curve to use to generate a key. Valid values are P224, P256, P384, P521",
        },
        cli.IntFlag{
            Name:  "rsa-bits",
            Value: 2048,
            Usage: "Size of RSA key to generate. Ignored if --ecdsa-curve is set",
        },
        cli.StringFlag{
            Name:  "start-date",
            Value: "",
            Usage: "Creation date formatted as Jan 1 15:04:05 2011",
        },
        cli.DurationFlag{
            Name:  "duration",
            Value: 365 * 24 * time.Hour,
            Usage: "Duration that certificate is valid for",
        },
        cli.BoolFlag{
            Name:  "ca",
            Usage: "whether this cert should be its own Certificate Authority",
        },
    },
}

CmdCert represents the available cert sub-command.

var CmdConvert = cli.Command{
    Name:        "convert",
    Usage:       "Convert the database",
    Description: "A command to convert an existing MySQL database from utf8 to utf8mb4",
    Action:      runConvert,
}

CmdConvert represents the available convert sub-command.

var CmdDocs = cli.Command{
    Name:        "docs",
    Usage:       "Output CLI documentation",
    Description: "A command to output Gitea's CLI documentation, optionally to a file.",
    Action:      runDocs,
    Flags: []cli.Flag{
        &cli.BoolFlag{
            Name:  "man",
            Usage: "Output man pages instead",
        },
        &cli.StringFlag{
            Name:  "output, o",
            Usage: "Path to output to instead of stdout (will overwrite if exists)",
        },
    },
}

CmdDocs represents the available docs sub-command.

var CmdDoctor = cli.Command{
    Name:        "doctor",
    Usage:       "Diagnose problems",
    Description: "A command to diagnose problems with the current Gitea instance according to the given configuration.",
    Action:      runDoctor,
    Flags: []cli.Flag{
        cli.BoolFlag{
            Name:  "list",
            Usage: "List the available checks",
        },
        cli.BoolFlag{
            Name:  "default",
            Usage: "Run the default checks (if neither --run or --all is set, this is the default behaviour)",
        },
        cli.StringSliceFlag{
            Name:  "run",
            Usage: "Run the provided checks - (if --default is set, the default checks will also run)",
        },
        cli.BoolFlag{
            Name:  "all",
            Usage: "Run all the available checks",
        },
        cli.BoolFlag{
            Name:  "fix",
            Usage: "Automatically fix what we can",
        },
        cli.StringFlag{
            Name:  "log-file",
            Usage: `Name of the log file (default: "doctor.log"). Set to "-" to output to stdout, set to "" to disable`,
        },
        cli.BoolFlag{
            Name:  "color, H",
            Usage: "Use color for outputted information",
        },
    },
    Subcommands: []cli.Command{
        cmdRecreateTable,
    },
}

CmdDoctor represents the available doctor sub-command.

var CmdDump = cli.Command{
    Name:        "dump",
    Usage:       "Dump Gitea files and database",
    Description: "" /* 142 byte string literal not displayed */,

    Action: runDump,
    Flags: []cli.Flag{
        cli.StringFlag{
            Name:  "file, f",
            Value: fmt.Sprintf("gitea-dump-%d.zip", time.Now().Unix()),
            Usage: "Name of the dump file which will be created. Supply '-' for stdout. See type for available types.",
        },
        cli.BoolFlag{
            Name:  "verbose, V",
            Usage: "Show process details",
        },
        cli.StringFlag{
            Name:  "tempdir, t",
            Value: os.TempDir(),
            Usage: "Temporary dir path",
        },
        cli.StringFlag{
            Name:  "database, d",
            Usage: "Specify the database SQL syntax",
        },
        cli.BoolFlag{
            Name:  "skip-repository, R",
            Usage: "Skip the repository dumping",
        },
        cli.BoolFlag{
            Name:  "skip-log, L",
            Usage: "Skip the log dumping",
        },
        cli.GenericFlag{
            Name:  "type",
            Value: outputTypeEnum,
            Usage: fmt.Sprintf("Dump output format: %s", outputTypeEnum.Join()),
        },
    },
}

CmdDump represents the available dump sub-command.

var CmdDumpRepository = cli.Command{
    Name:        "dump-repo",
    Usage:       "Dump the repository from git/github/gitea/gitlab",
    Description: "This is a command for dumping the repository data.",
    Action:      runDumpRepository,
    Flags: []cli.Flag{
        cli.StringFlag{
            Name:  "git_service",
            Value: "",
            Usage: "Git service, git, github, gitea, gitlab. If clone_addr could be recognized, this could be ignored.",
        },
        cli.StringFlag{
            Name:  "repo_dir, r",
            Value: "./data",
            Usage: "Repository dir path to store the data",
        },
        cli.StringFlag{
            Name:  "clone_addr",
            Value: "",
            Usage: "The URL will be clone, currently could be a git/github/gitea/gitlab http/https URL",
        },
        cli.StringFlag{
            Name:  "auth_username",
            Value: "",
            Usage: "The username to visit the clone_addr",
        },
        cli.StringFlag{
            Name:  "auth_password",
            Value: "",
            Usage: "The password to visit the clone_addr",
        },
        cli.StringFlag{
            Name:  "auth_token",
            Value: "",
            Usage: "The personal token to visit the clone_addr",
        },
        cli.StringFlag{
            Name:  "owner_name",
            Value: "",
            Usage: "The data will be stored on a directory with owner name if not empty",
        },
        cli.StringFlag{
            Name:  "repo_name",
            Value: "",
            Usage: "The data will be stored on a directory with repository name if not empty",
        },
        cli.StringFlag{
            Name:  "units",
            Value: "",
            Usage: "" /* 200 byte string literal not displayed */,
        },
    },
}

CmdDumpRepository represents the available dump repository sub-command.

var (
    // CmdGenerate represents the available generate sub-command.
    CmdGenerate = cli.Command{
        Name:  "generate",
        Usage: "Command line interface for running generators",
        Subcommands: []cli.Command{
            subcmdSecret,
        },
    }
)
var (
    // CmdHook represents the available hooks sub-command.
    CmdHook = cli.Command{
        Name:        "hook",
        Usage:       "Delegate commands to corresponding Git hooks",
        Description: "This should only be called by Git",
        Subcommands: []cli.Command{
            subcmdHookPreReceive,
            subcmdHookUpdate,
            subcmdHookPostReceive,
        },
    }
)
var CmdKeys = cli.Command{
    Name:   "keys",
    Usage:  "This command queries the Gitea database to get the authorized command for a given ssh key fingerprint",
    Action: runKeys,
    Flags: []cli.Flag{
        cli.StringFlag{
            Name:  "expected, e",
            Value: "git",
            Usage: "Expected user for whom provide key commands",
        },
        cli.StringFlag{
            Name:  "username, u",
            Value: "",
            Usage: "Username trying to log in by SSH",
        },
        cli.StringFlag{
            Name:  "type, t",
            Value: "",
            Usage: "Type of the SSH key provided to the SSH Server (requires content to be provided too)",
        },
        cli.StringFlag{
            Name:  "content, k",
            Value: "",
            Usage: "Base64 encoded content of the SSH key provided to the SSH Server (requires type to be provided too)",
        },
    },
}

CmdKeys represents the available keys sub-command

var (
    // CmdManager represents the manager command
    CmdManager = cli.Command{
        Name:        "manager",
        Usage:       "Manage the running gitea process",
        Description: "This is a command for managing the running gitea process",
        Subcommands: []cli.Command{
            subcmdShutdown,
            subcmdRestart,
            subcmdFlushQueues,
            subcmdLogging,
        },
    }
)
var CmdMigrate = cli.Command{
    Name:        "migrate",
    Usage:       "Migrate the database",
    Description: "This is a command for migrating the database, so that you can run gitea admin create-user before starting the server.",
    Action:      runMigrate,
}

CmdMigrate represents the available migrate sub-command.

var CmdMigrateStorage = cli.Command{
    Name:        "migrate-storage",
    Usage:       "Migrate the storage",
    Description: "This is a command for migrating storage.",
    Action:      runMigrateStorage,
    Flags: []cli.Flag{
        cli.StringFlag{
            Name:  "type, t",
            Value: "",
            Usage: "Kinds of files to migrate, currently only 'attachments' is supported",
        },
        cli.StringFlag{
            Name:  "storage, s",
            Value: "",
            Usage: "New storage type: local (default) or minio",
        },
        cli.StringFlag{
            Name:  "path, p",
            Value: "",
            Usage: "New storage placement if store is local (leave blank for default)",
        },
        cli.StringFlag{
            Name:  "minio-endpoint",
            Value: "",
            Usage: "Minio storage endpoint",
        },
        cli.StringFlag{
            Name:  "minio-access-key-id",
            Value: "",
            Usage: "Minio storage accessKeyID",
        },
        cli.StringFlag{
            Name:  "minio-secret-access-key",
            Value: "",
            Usage: "Minio storage secretAccessKey",
        },
        cli.StringFlag{
            Name:  "minio-bucket",
            Value: "",
            Usage: "Minio storage bucket",
        },
        cli.StringFlag{
            Name:  "minio-location",
            Value: "",
            Usage: "Minio storage location to create bucket",
        },
        cli.StringFlag{
            Name:  "minio-base-path",
            Value: "",
            Usage: "Minio storage basepath on the bucket",
        },
        cli.BoolFlag{
            Name:  "minio-use-ssl",
            Usage: "Enable SSL for minio",
        },
    },
}

CmdMigrateStorage represents the available migrate storage sub-command.

var CmdRestoreRepository = cli.Command{
    Name:        "restore-repo",
    Usage:       "Restore the repository from disk",
    Description: "This is a command for restoring the repository data.",
    Action:      runRestoreRepository,
    Flags: []cli.Flag{
        cli.StringFlag{
            Name:  "repo_dir, r",
            Value: "./data",
            Usage: "Repository dir path to restore from",
        },
        cli.StringFlag{
            Name:  "owner_name",
            Value: "",
            Usage: "Restore destination owner name",
        },
        cli.StringFlag{
            Name:  "repo_name",
            Value: "",
            Usage: "Restore destination repository name",
        },
        cli.StringFlag{
            Name:  "units",
            Value: "",
            Usage: "" /* 200 byte string literal not displayed */,
        },
    },
}

CmdRestoreRepository represents the available restore a repository sub-command.

var CmdServ = cli.Command{
    Name:        "serv",
    Usage:       "This command should only be called by SSH shell",
    Description: `Serv provide access auth for repositories`,
    Action:      runServ,
    Flags: []cli.Flag{
        cli.BoolFlag{
            Name: "enable-pprof",
        },
        cli.BoolFlag{
            Name: "debug",
        },
    },
}

CmdServ represents the available serv sub-command.

var CmdWeb = cli.Command{
    Name:  "web",
    Usage: "Start Gitea web server",
    Description: `Gitea web server is the only thing you need to run,
and it takes care of all the other things for you`,
    Action: runWeb,
    Flags: []cli.Flag{
        cli.StringFlag{
            Name:  "port, p",
            Value: "3000",
            Usage: "Temporary port number to prevent conflict",
        },
        cli.StringFlag{
            Name:  "install-port",
            Value: "3000",
            Usage: "Temporary port number to run the install page on to prevent conflict",
        },
        cli.StringFlag{
            Name:  "pid, P",
            Value: setting.PIDFile,
            Usage: "Custom pid file path",
        },
    },
}

CmdWeb represents the available web sub-command.

var (
    Cmdembedded = cli.Command{
        Name:        "embedded",
        Usage:       "Extract embedded resources",
        Description: "A command for extracting embedded resources, like templates and images",
        Action:      extractorNotImplemented,
    }
)

Cmdembedded represents the available extract sub-command.

func NoHTTPRedirector Uses

func NoHTTPRedirector()

NoHTTPRedirector tells our cleanup routine that we will not be using a fallback http redirector

func NoInstallListener Uses

func NoInstallListener()

NoInstallListener tells our cleanup routine that we will not be using a possibly provided listener for our install HTTP/HTTPS service

func NoMainListener Uses

func NoMainListener()

NoMainListener tells our cleanup routine that we will not be using a possibly provided listener for our main HTTP/HTTPS service

Package cmd imports 66 packages (graph) and is imported by 1 packages. Updated 2021-01-22. Refresh now. Tools for package owners.