Fix the fucky-wucky when calling spwn with no commands
use ariadne::Fmt;
+use clap::AppSettings;
use clap::arg;
use clap::ValueHint;
//#![feature(arbitrary_enum_discriminant)]
@@ -123,10 +124,13 @@ impl<'a> BuildOptions<'a> {
}
fn main() -> Result<(), Box<dyn std::error::Error>> {
- let matches = App::new("SPWN").subcommands(
+ let app = App::new("SPWN")
+ .global_setting(AppSettings::ArgRequiredElseHelp)
+ .subcommands(
[
App::new("build")
- .about("Runs/builds a given file")
+ .about("Runs/builds a given file"
+ )
.visible_alias("b")
.args(&[
arg!(<SCRIPT> "Path to spwn source file").value_hint(ValueHint::AnyPath),
@@ -162,7 +166,8 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
)
.about("Generates documentation for a SPWN library, in the form of a markdown file"),
]
- ).get_matches();
+ );
+ let matches = app.get_matches();
if let Some(build_cmd) = matches.subcommand_matches("build") {
let script_path = build_cmd.value_of("SCRIPT").ok_or("unreachable")?;
