fix: change app name in cmd (#36)

This commit is contained in:
Kuingsmile
2025-06-13 15:19:25 +08:00
committed by GitHub
parent b8e6083e19
commit 7cd8f648c8
7 changed files with 14 additions and 13 deletions

View File

@ -26,8 +26,8 @@ var AdminCmd = &cobra.Command{
} else { } else {
utils.Log.Infof("Admin user's username: %s", admin.Username) utils.Log.Infof("Admin user's username: %s", admin.Username)
utils.Log.Infof("The password can only be output at the first startup, and then stored as a hash value, which cannot be reversed") utils.Log.Infof("The password can only be output at the first startup, and then stored as a hash value, which cannot be reversed")
utils.Log.Infof("You can reset the password with a random string by running [alist admin random]") utils.Log.Infof("You can reset the password with a random string by running [openlist admin random]")
utils.Log.Infof("You can also set a new password by running [alist admin set NEW_PASSWORD]") utils.Log.Infof("You can also set a new password by running [openlist admin set NEW_PASSWORD]")
} }
}, },
} }

View File

@ -1,15 +1,16 @@
package cmd package cmd
import ( import (
"os"
log "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"os"
) )
// KillCmd represents the kill command // KillCmd represents the kill command
var KillCmd = &cobra.Command{ var KillCmd = &cobra.Command{
Use: "kill", Use: "kill",
Short: "Force kill alist server process by daemon/pid file", Short: "Force kill openlist server process by daemon/pid file",
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
kill() kill()
}, },
@ -18,7 +19,7 @@ var KillCmd = &cobra.Command{
func kill() { func kill() {
initDaemon() initDaemon()
if pid == -1 { if pid == -1 {
log.Info("Seems not have been started. Try use `alist start` to start server.") log.Info("Seems not have been started. Try use `openlist start` to start server.")
return return
} }
process, err := os.FindProcess(pid) process, err := os.FindProcess(pid)

View File

@ -10,7 +10,7 @@ import (
// RestartCmd represents the restart command // RestartCmd represents the restart command
var RestartCmd = &cobra.Command{ var RestartCmd = &cobra.Command{
Use: "restart", Use: "restart",
Short: "Restart alist server by daemon/pid file", Short: "Restart openlist server by daemon/pid file",
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
stop() stop()
start() start()

View File

@ -12,7 +12,7 @@ import (
) )
var RootCmd = &cobra.Command{ var RootCmd = &cobra.Command{
Use: "alist", Use: "openlist",
Short: "A file list program that supports multiple storage.", Short: "A file list program that supports multiple storage.",
Long: `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. built with love by Xhofe and friends in Go/Solid.js.

View File

@ -16,7 +16,7 @@ import (
// StartCmd represents the start command // StartCmd represents the start command
var StartCmd = &cobra.Command{ var StartCmd = &cobra.Command{
Use: "start", Use: "start",
Short: "Silent start alist server with `--force-bin-dir`", Short: "Silent start openlist server with `--force-bin-dir`",
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
start() start()
}, },
@ -27,7 +27,7 @@ func start() {
if pid != -1 { if pid != -1 {
_, err := os.FindProcess(pid) _, err := os.FindProcess(pid)
if err == nil { if err == nil {
log.Info("alist already started, pid ", pid) log.Info("openlist already started, pid ", pid)
return return
} }
} }
@ -52,7 +52,7 @@ func start() {
log.Infof("success start pid: %d", cmd.Process.Pid) log.Infof("success start pid: %d", cmd.Process.Pid)
err = os.WriteFile(pidFile, []byte(strconv.Itoa(cmd.Process.Pid)), 0666) err = os.WriteFile(pidFile, []byte(strconv.Itoa(cmd.Process.Pid)), 0666)
if err != nil { if err != nil {
log.Warn("failed to record pid, you may not be able to stop the program with `./alist stop`") log.Warn("failed to record pid, you may not be able to stop the program with `./openlist stop`")
} }
} }

View File

@ -13,7 +13,7 @@ import (
// StopCmd represents the stop command // StopCmd represents the stop command
var StopCmd = &cobra.Command{ var StopCmd = &cobra.Command{
Use: "stop", Use: "stop",
Short: "Stop alist server by daemon/pid file", Short: "Stop openlist server by daemon/pid file",
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
stop() stop()
}, },
@ -22,7 +22,7 @@ var StopCmd = &cobra.Command{
func stop() { func stop() {
initDaemon() initDaemon()
if pid == -1 { if pid == -1 {
log.Info("Seems not have been started. Try use `alist start` to start server.") log.Info("Seems not have been started. Try use `openlist start` to start server.")
return return
} }
process, err := os.FindProcess(pid) process, err := os.FindProcess(pid)

View File

@ -15,7 +15,7 @@ import (
// VersionCmd represents the version command // VersionCmd represents the version command
var VersionCmd = &cobra.Command{ var VersionCmd = &cobra.Command{
Use: "version", Use: "version",
Short: "Show current version of AList", Short: "Show current version of OpenList",
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
goVersion := fmt.Sprintf("%s %s/%s", runtime.Version(), runtime.GOOS, runtime.GOARCH) goVersion := fmt.Sprintf("%s %s/%s", runtime.Version(), runtime.GOOS, runtime.GOARCH)