@@ -68,7 +68,7 @@ arguments - which can alternatively be run by running the subcommand web.`
68
68
// Now adjust these commands to add our global configuration options
69
69
70
70
// First calculate the default paths and set the AppHelpTemplates in this context
71
- setting .SetCustomPathAndConf ("" , "" )
71
+ setting .SetCustomPathAndConf ("" , "" , "" )
72
72
setAppHelpTemplates ()
73
73
74
74
// default configuration flags
@@ -84,6 +84,11 @@ arguments - which can alternatively be run by running the subcommand web.`
84
84
Usage : "Custom configuration file path" ,
85
85
},
86
86
cli .VersionFlag ,
87
+ cli.StringFlag {
88
+ Name : "work-path, w" ,
89
+ Value : setting .AppWorkPath ,
90
+ Usage : "Set the gitea working path" ,
91
+ },
87
92
}
88
93
89
94
// Set the default to be equivalent to cmdWeb and add the default flags
@@ -114,10 +119,11 @@ func setFlagsAndBeforeOnSubcommands(command *cli.Command, defaultFlags []cli.Fla
114
119
func establishCustomPath (ctx * cli.Context ) error {
115
120
var providedCustom string
116
121
var providedConf string
122
+ var providedWorkPath string
117
123
118
124
currentCtx := ctx
119
125
for {
120
- if len (providedCustom ) != 0 && len (providedConf ) != 0 {
126
+ if len (providedCustom ) != 0 && len (providedConf ) != 0 && len ( providedWorkPath ) != 0 {
121
127
break
122
128
}
123
129
if currentCtx == nil {
@@ -129,10 +135,13 @@ func establishCustomPath(ctx *cli.Context) error {
129
135
if currentCtx .IsSet ("config" ) && len (providedConf ) == 0 {
130
136
providedConf = currentCtx .String ("config" )
131
137
}
138
+ if currentCtx .IsSet ("work-path" ) && len (providedWorkPath ) == 0 {
139
+ providedWorkPath = currentCtx .String ("work-path" )
140
+ }
132
141
currentCtx = currentCtx .Parent ()
133
142
134
143
}
135
- setting .SetCustomPathAndConf (providedCustom , providedConf )
144
+ setting .SetCustomPathAndConf (providedCustom , providedConf , providedWorkPath )
136
145
137
146
setAppHelpTemplates ()
138
147
0 commit comments