// CmdDoctor represents the available doctor sub-command.
// CmdDoctor represents the available doctor sub-command.
varCmdDoctor=&cli.Command{
varCmdDoctor=&cli.Command{
Name:"doctor",
Name:"doctor",
Usage:"Diagnose and optionally fix problems",
Usage:"Diagnose and optionally fix problems, convert or re-create database tables",
Description:"A command to diagnose problems with the current Gitea instance according to the given configuration. Some problems can optionally be fixed by modifying the database or data storage.",
Description:"A command to diagnose problems with the current Gitea instance according to the given configuration. Some problems can optionally be fixed by modifying the database or data storage.",
// cmdHelp is our own help subcommand with more information
// cmdHelp is our own help subcommand with more information
// Keep in mind that the "./gitea help"(subcommand) is different from "./gitea --help"(flag), the flag doesn't parse the config or output "DEFAULT CONFIGURATION:" information
funccmdHelp()*cli.Command{
funccmdHelp()*cli.Command{
c:=&cli.Command{
c:=&cli.Command{
Name:"help",
Name:"help",
@ -47,16 +47,10 @@ DEFAULT CONFIGURATION:
returnc
returnc
}
}
varhelpFlag=cli.HelpFlag
funcinit(){
// cli.HelpFlag = nil TODO: after https://github.com/urfave/cli/issues/1794 we can use this
}
funcappGlobalFlags()[]cli.Flag{
funcappGlobalFlags()[]cli.Flag{
return[]cli.Flag{
return[]cli.Flag{
// make the builtin flags at the top
// make the builtin flags at the top
helpFlag,
cli.HelpFlag,
// shared configuration flags, they are for global and for each sub-command at the same time
// shared configuration flags, they are for global and for each sub-command at the same time
// eg: such command is valid: "./gitea --config /tmp/app.ini web --config /tmp/app.ini", while it's discouraged indeed
// eg: such command is valid: "./gitea --config /tmp/app.ini web --config /tmp/app.ini", while it's discouraged indeed
app.Description=`By default, Gitea will start serving using the web-server with no argument, which can alternatively be run by running the subcommand "web".`
app.Description=`Gitea program contains "web" and other subcommands. If no subcommand is given, it starts the web server by default. Use "web" subcommand for more web server arguments, use other subcommands for other purposes.`
app.Version=version+versionExtra
app.Version=version+versionExtra
app.EnableBashCompletion=true
app.EnableBashCompletion=true
// these sub-commands need to use config file
// these sub-commands need to use config file
subCmdWithConfig:=[]*cli.Command{
subCmdWithConfig:=[]*cli.Command{
cmdHelp(),// the "help" sub-command was used to show the more information for "work path" and "custom config"