@@ -8,6 +8,18 @@ use log::info;
8
8
9
9
use crate :: utils:: get_host_arch_name;
10
10
11
+ const WORKSPACE_ARGS : & [ & str ] = & [
12
+ "maintainer" ,
13
+ "dnssec" ,
14
+ "repo" ,
15
+ "local-repo" ,
16
+ "source-cache" ,
17
+ "nspawn-opt" ,
18
+ "branch-exclusive-output" ,
19
+ "volatile-mount" ,
20
+ "use-apt" ,
21
+ ] ;
22
+
11
23
#[ inline]
12
24
fn config_list < V > ( args : & ArgMatches , id : & str , list : & mut Vec < V > )
13
25
where
@@ -81,6 +93,19 @@ pub fn config_instance(instance: &str, args: &ArgMatches) -> Result<()> {
81
93
82
94
/// Applies workspace configuration patches from [ArgMatches].
83
95
pub fn patch_workspace_config ( args : & ArgMatches , config : & mut WorkspaceConfig ) -> Result < ( ) > {
96
+ let mut has_args = false ;
97
+ for i in WORKSPACE_ARGS {
98
+ if args. get_raw ( i) . is_some ( ) {
99
+ has_args = true ;
100
+ break ;
101
+ }
102
+ }
103
+
104
+ if !has_args {
105
+ ask_for_config ( config) ?;
106
+ return Ok ( ( ) ) ;
107
+ }
108
+
84
109
if let Some ( maintainer) = args. get_one :: < String > ( "maintainer" ) {
85
110
if maintainer != & config. maintainer {
86
111
WorkspaceConfig :: validate_maintainer ( maintainer) ?;
@@ -138,7 +163,7 @@ pub fn patch_instance_config(args: &ArgMatches, config: &mut InstanceConfig) ->
138
163
}
139
164
140
165
/// Shows a series of prompts to let the user select the configurations
141
- pub fn ask_for_init_config ( config : & mut WorkspaceConfig ) -> Result < ( ) > {
166
+ pub fn ask_for_config ( config : & mut WorkspaceConfig ) -> Result < ( ) > {
142
167
let theme = ColorfulTheme :: default ( ) ;
143
168
config. maintainer = Input :: < String > :: with_theme ( & theme)
144
169
. with_prompt ( "Maintainer" )
0 commit comments