mirror of
https://github.com/cloudreve/cloudreve.git
synced 2025-10-27 18:44:44 +08:00
Init V4 community edition (#2265)
* Init V4 community edition * Init V4 community edition
This commit is contained in:
30
cmd/eject.go
Normal file
30
cmd/eject.go
Normal file
@ -0,0 +1,30 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"github.com/cloudreve/Cloudreve/v4/application/constants"
|
||||
"github.com/cloudreve/Cloudreve/v4/application/dependency"
|
||||
"github.com/cloudreve/Cloudreve/v4/application/statics"
|
||||
"github.com/spf13/cobra"
|
||||
"os"
|
||||
)
|
||||
|
||||
func init() {
|
||||
rootCmd.AddCommand(ejectCmd)
|
||||
}
|
||||
|
||||
var ejectCmd = &cobra.Command{
|
||||
Use: "eject",
|
||||
Short: "Eject all embedded static files",
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
dep := dependency.NewDependency(
|
||||
dependency.WithConfigPath(confPath),
|
||||
dependency.WithProFlag(constants.IsPro == "true"),
|
||||
)
|
||||
logger := dep.Logger()
|
||||
|
||||
if err := statics.Eject(dep.Logger(), dep.Statics()); err != nil {
|
||||
logger.Error("Failed to eject static files: %s", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user