2022-08-07 05:09:59 +00:00
package cmd
import (
"fmt"
"os"
"github.com/alist-org/alist/v3/cmd/flags"
2023-11-06 08:56:55 +00:00
_ "github.com/alist-org/alist/v3/drivers"
_ "github.com/alist-org/alist/v3/internal/offline_download"
2022-08-07 05:09:59 +00:00
"github.com/spf13/cobra"
)
2022-12-18 11:53:39 +00:00
var RootCmd = & cobra . Command {
2022-08-07 05:09:59 +00:00
Use : "alist" ,
Short : "A file list program that supports multiple storage." ,
Long : ` A file list program that supports multiple storage ,
built with love by Xhofe and friends in Go / Solid . js .
Complete documentation is available at https : //alist.nn.ci/`,
}
func Execute ( ) {
2022-12-18 11:53:39 +00:00
if err := RootCmd . Execute ( ) ; err != nil {
2022-08-07 05:09:59 +00:00
fmt . Fprintln ( os . Stderr , err )
os . Exit ( 1 )
}
}
func init ( ) {
2023-06-10 14:25:35 +00:00
RootCmd . PersistentFlags ( ) . StringVar ( & flags . DataDir , "data" , "data" , "data folder" )
2022-12-18 11:53:39 +00:00
RootCmd . PersistentFlags ( ) . BoolVar ( & flags . Debug , "debug" , false , "start with debug mode" )
RootCmd . PersistentFlags ( ) . BoolVar ( & flags . NoPrefix , "no-prefix" , false , "disable env prefix" )
RootCmd . PersistentFlags ( ) . BoolVar ( & flags . Dev , "dev" , false , "start with dev mode" )
RootCmd . PersistentFlags ( ) . BoolVar ( & flags . ForceBinDir , "force-bin-dir" , false , "Force to use the directory where the binary file is located as data directory" )
2023-03-05 07:07:06 +00:00
RootCmd . PersistentFlags ( ) . BoolVar ( & flags . LogStd , "log-std" , false , "Force to log to std" )
2022-08-07 05:09:59 +00:00
}