@@ -141,8 +141,8 @@ pub(crate) enum RelayChain {
141141#[ derive( Args , Default ) ]
142142pub struct BuildSpecCommand {
143143 /// Directory path for your project [default: current directory]
144- #[ arg( long) ]
145- pub ( crate ) path : Option < PathBuf > ,
144+ #[ arg( long, default_value = "./Cargo.toml" ) ]
145+ pub ( crate ) path : PathBuf ,
146146 /// File name for the resulting spec. If a path is given,
147147 /// the necessary directories will be created
148148 #[ arg( short, long = "output" ) ]
@@ -194,7 +194,7 @@ impl BuildSpecCommand {
194194 let mut cli = Cli ;
195195 cli. intro ( "Generate your chain spec" ) ?;
196196 // Checks for appchain project.
197- if is_supported ( self . path . as_deref ( ) ) ? {
197+ if is_supported ( self . path . as_path ( ) ) ? {
198198 let build_spec = self . configure_build_spec ( & mut cli) . await ?;
199199 if let Err ( e) = build_spec. build ( & mut cli) {
200200 cli. outro_cancel ( e. to_string ( ) ) ?;
@@ -234,9 +234,6 @@ impl BuildSpecCommand {
234234 ..
235235 } = self ;
236236
237- // Project path.
238- let path = path. unwrap_or ( PathBuf :: from ( "./" ) ) ;
239-
240237 // Chain.
241238 let chain = match chain {
242239 Some ( chain) => chain,
@@ -252,9 +249,7 @@ impl BuildSpecCommand {
252249 // Output file.
253250 let maybe_chain_spec_file = PathBuf :: from ( & chain) ;
254251 // Check if the provided chain specification is a file.
255- let ( output_file, prompt) = if maybe_chain_spec_file. exists ( ) &&
256- maybe_chain_spec_file. is_file ( )
257- {
252+ let ( output_file, prompt) = if maybe_chain_spec_file. is_file ( ) {
258253 if output_file. is_some ( ) {
259254 cli. warning ( "NOTE: If an existing chain spec file is provided it will be used for the output path." ) ?;
260255 }
@@ -450,7 +445,7 @@ impl BuildSpecCommand {
450445 let package = if deterministic {
451446 package
452447 . or_else ( || {
453- from_path ( Some ( & runtime_dir) )
448+ from_path ( & runtime_dir)
454449 . ok ( )
455450 . and_then ( |manifest| manifest. package . map ( |pkg| pkg. name ) )
456451 } )
@@ -745,13 +740,14 @@ mod tests {
745740 let deterministic = true ;
746741 let package = "runtime-name" ;
747742 let runtime_dir = PathBuf :: from ( "./new-runtime-dir" ) ;
743+ let path = PathBuf :: from ( "./" ) ;
748744
749745 for build_spec_cmd in [
750746 // No flags used.
751747 BuildSpecCommand :: default ( ) ,
752748 // All flags used.
753749 BuildSpecCommand {
754- path : None ,
750+ path,
755751 output_file : Some ( PathBuf :: from ( output_file) ) ,
756752 profile : Some ( profile. clone ( ) ) ,
757753 id : Some ( para_id) ,
@@ -839,6 +835,7 @@ mod tests {
839835 let deterministic = true ;
840836 let package = "runtime-name" ;
841837 let runtime_dir = PathBuf :: from ( "./new-runtime-dir" ) ;
838+ let path = PathBuf :: from ( "./" ) ;
842839
843840 // Create a temporary file to act as the existing chain spec file.
844841 let temp_dir = tempdir ( ) ?;
@@ -855,7 +852,7 @@ mod tests {
855852 } ,
856853 // All flags used.
857854 BuildSpecCommand {
858- path : None ,
855+ path : path . clone ( ) ,
859856 output_file : Some ( PathBuf :: from ( output_file) ) ,
860857 profile : Some ( profile. clone ( ) ) ,
861858 id : Some ( para_id) ,
0 commit comments