cli: rename type-check to check, print a message when there are no input files

This commit is contained in:
Romain Paquet 2024-12-09 14:17:41 +01:00
parent 78b20f3603
commit 0504f09d56

View file

@ -32,7 +32,7 @@ enum Commands {
#[arg(long)] #[arg(long)]
dump_ast: bool, dump_ast: bool,
}, },
TypeCheck { Check {
/// Paths to the source files /// Paths to the source files
files: Vec<String>, files: Vec<String>,
@ -96,7 +96,7 @@ fn main() {
println!("Parsing OK"); println!("Parsing OK");
} }
Commands::TypeCheck { files, dump_ast } => { Commands::Check { files, dump_ast } => {
let mut source_cache = SourceCache { let mut source_cache = SourceCache {
paths: files.iter().map(PathBuf::from).collect(), paths: files.iter().map(PathBuf::from).collect(),
file_cache: ariadne::FileCache::default(), file_cache: ariadne::FileCache::default(),
@ -111,6 +111,11 @@ fn main() {
} }
Commands::Compile { files, dump_clir } | Commands::Run { files, dump_clir } => { Commands::Compile { files, dump_clir } | Commands::Run { files, dump_clir } => {
if files.is_empty() {
println!("No input files");
return;
}
let mut source_cache = SourceCache { let mut source_cache = SourceCache {
paths: files.iter().map(PathBuf::from).collect(), paths: files.iter().map(PathBuf::from).collect(),
file_cache: ariadne::FileCache::default(), file_cache: ariadne::FileCache::default(),