1
0
mirror of https://github.com/KarolS/millfork.git synced 2024-09-27 12:57:41 +00:00

Make the -o option optional

This commit is contained in:
Karol Stasiak 2019-10-22 00:14:38 +02:00
parent 052aa9d458
commit 2d50e4fa73
2 changed files with 12 additions and 3 deletions

View File

@ -28,6 +28,8 @@ no extension for BBC micro program file,
`.inf` for BBC Micro file metadata,
`.asm` for assembly output,
`.lbl`, `.nl`, `.fns`, or `.sym` for label file.
Default: If compiling one file with `.mfk` extension, the same name as the input file. Otherwise, `a`.
* `-s` Generate also the assembly output. It is not compatible with any assembler, but it serves purely informational purpose. The file has the same nam as the output file and the extension is `.asm`.

View File

@ -66,7 +66,14 @@ object Main {
case (f, b) => errorReporting.debug(f" $f%-30s : $b%s")
}
val output = c.outputFileName.getOrElse("a")
val output = c.outputFileName match {
case Some(ofn) => ofn
case None => c.inputFileNames match {
case List(ifn) if ifn.endsWith(".mfk") =>
new File(ifn.stripSuffix(".mfk")).getName
case _ => "a"
}
}
val assOutput = output + ".asm"
// val prgOutputs = (platform.outputStyle match {
// case OutputStyle.Single => List("default")
@ -369,10 +376,10 @@ object Main {
fluff("Main options:", "")
parameter("-o", "--out").required().placeholder("<file>").action { (p, c) =>
parameter("-o", "--out").placeholder("<file>").action { (p, c) =>
assertNone(c.outputFileName, "Output already defined")
c.copy(outputFileName = Some(p))
}.description("The output file name, without extension.").onWrongNumber(_ => errorReporting.fatalQuit("No output file specified"))
}.description("The output file name, without extension.")
flag("-s").action { c =>
c.copy(outputAssembly = true)