using unix convention for cmd args

This commit is contained in:
minjaesong
2023-05-10 09:41:43 +09:00
parent beecc0b5eb
commit ba5c87530f
16 changed files with 34 additions and 34 deletions

View File

@@ -5,4 +5,4 @@ set PATH=\tvdos\installer;\tvdos\tuidev;$PATH
set KEYBOARD=us_colemak
rem this line specifies which shell to be presented after the boot precess:
command /fancy
command -fancy

View File

@@ -460,21 +460,21 @@ _G.shell = shell;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if (exec_args[1] !== undefined) {
// only meaningful switches would be either /c or /k anyway
// only meaningful switches would be either -c or -k anyway
var firstSwitch = exec_args[1].toLowerCase();
// command /c <commands>
// command -c <commands>
// ^[0] ^[1] ^[2]
if ("/c" == firstSwitch) {
if ("-c" == firstSwitch) {
if ("" == exec_args[2]) return 0; // no commands were given, just exit successfully
return shell.execute(exec_args[2]);
}
else if ("/k" == firstSwitch) {
else if ("-k" == firstSwitch) {
if ("" == exec_args[2]) return 0; // no commands were given, just exit successfully
shell.execute(exec_args[2]);
goInteractive = true;
}
else if ("/fancy" == firstSwitch) {
else if ("-fancy" == firstSwitch) {
graphics.setBackground(2,3,4);
goFancy = true;
goInteractive = true;

View File

@@ -5,4 +5,4 @@ rem e.g. set PATH=\home\my-cool-project;$PATH
set KEYBOARD=us_qwerty
rem this line specifies which shell to be presented after the boot precess:
command /fancy
command -fancy

View File

@@ -1236,4 +1236,4 @@ serial.println(`TVDOS.SYS initialised on VM ${sys.getVmId()}, running boot scrip
var _G = {};
let cmdfile = files.open("A:/tvdos/bin/command.js")
eval(`var _AUTOEXEC=function(exec_args){${cmdfile.sread()}\n};` +
`_AUTOEXEC`)(["", "/c", "\\AUTOEXEC.BAT"])
`_AUTOEXEC`)(["", "-c", "\\AUTOEXEC.BAT"])

View File

@@ -848,21 +848,21 @@ _G.shell = shell
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if (exec_args[1] !== undefined) {
// only meaningful switches would be either /c or /k anyway
// only meaningful switches would be either -c or -k anyway
var firstSwitch = exec_args[1].toLowerCase()
// command /c <commands>
// command -c <commands>
// ^[0] ^[1] ^[2]
if ("/c" == firstSwitch) {
if ("-c" == firstSwitch) {
if ("" == exec_args[2]) return 0 // no commands were given, just exit successfully
return shell.execute(exec_args[2])
}
else if ("/k" == firstSwitch) {
else if ("-k" == firstSwitch) {
if ("" == exec_args[2]) return 0 // no commands were given, just exit successfully
shell.execute(exec_args[2])
goInteractive = true
}
else if ("/fancy" == firstSwitch) {
else if ("-fancy" == firstSwitch) {
graphics.setBackground(34,51,68)
goFancy = true
goInteractive = true

View File

@@ -3,7 +3,7 @@ if (exec_args[1] == undefined) {
return 1
}
const interactive = exec_args[2] && exec_args[2].toLowerCase() == "/i"
const interactive = exec_args[2] && exec_args[2].toLowerCase() == "-i"
let infile = files.open(_G.shell.resolvePathInput(exec_args[1]).full)
// read input file

View File

@@ -1,9 +1,9 @@
if (exec_args[3] == undefined) {
println("encodeipf <1/2> <input picture> <output filename> [/noalpha]")
println("encodeipf <1/2> <input picture> <output filename> [-noalpha]")
return 1
}
let noalpha = exec_args[4] != undefined && exec_args[4].toLowerCase() == "/noalpha"
let noalpha = exec_args[4] != undefined && exec_args[4].toLowerCase() == "-noalpha"
let infile = files.open(_G.shell.resolvePathInput(exec_args[2]).full)
let outfile = files.open(_G.shell.resolvePathInput(exec_args[3]).full)

View File

@@ -1,13 +1,13 @@
function printUsage() {
println(`Usage: gzip [/d /c] file
println(`Usage: gzip [-c] [-d] file
To compress a file, replacing it with a gzipped compressed version:
gzip file.ext
To decompress a file, replacing it with the original uncompressed version:
gzip /d file.ext.gz
gzip -d file.ext.gz
To compress a file specifying the output filename:
gzip /c file.ext > compressed_file.ext.gz
gzip -c file.ext > compressed_file.ext.gz
To decompress a gzipped file specifying the output filename:
gzip /c /d file.ext.gz > uncompressed_file.ext`)
gzip -c -d file.ext.gz > uncompressed_file.ext`)
}
if (exec_args[1] === undefined) {
@@ -23,8 +23,8 @@ if (filePath === undefined) {
return 0
}
const decompMode = (options.indexOf("/D") >= 0)
const toStdout = (options.indexOf("/C") >= 0)
const decompMode = (options.indexOf("-D") >= 0)
const toStdout = (options.indexOf("-C") >= 0)
const file = files.open(_G.shell.resolvePath(filePath).full)

View File

@@ -1,6 +1,6 @@
// usage: playmov moviefile.mov [/i]
const SND_BASE_ADDR = audio.getBaseAddr()
const interactive = exec_args[2] && exec_args[2].toLowerCase() == "/i"
const interactive = exec_args[2] && exec_args[2].toLowerCase() == "-i"
const WIDTH = 560
const HEIGHT = 448
const FBUF_SIZE = WIDTH * HEIGHT

View File

@@ -5,7 +5,7 @@ if (!SND_BASE_ADDR) return 10
const MP2_BITRATES = ["???", 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384]
const MP2_CHANNELMODES = ["Stereo", "Joint", "Dual", "Mono"]
const pcm = require("pcm")
const interactive = exec_args[2] && exec_args[2].toLowerCase() == "/i"
const interactive = exec_args[2] && exec_args[2].toLowerCase() == "-i"
function printdbg(s) { if (0) serial.println(s) }

View File

@@ -5,7 +5,7 @@ return 1
const Mp3 = require('mp3dec')
const pcm = require("pcm")
const interactive = exec_args[2] && exec_args[2].toLowerCase() == "/i"
const interactive = exec_args[2] && exec_args[2].toLowerCase() == "-i"
function printdbg(s) { if (0) serial.println(s) }

View File

@@ -3,7 +3,7 @@ let fileeeee = files.open(_G.shell.resolvePathInput(exec_args[1]).full)
let filename = fileeeee.fullPath
function printdbg(s) { if (0) serial.println(s) }
const interactive = exec_args[2] && exec_args[2].toLowerCase() == "/i"
const interactive = exec_args[2] && exec_args[2].toLowerCase() == "-i"
const pcm = require("pcm")
const FILE_SIZE = files.open(filename).size

View File

@@ -5,7 +5,7 @@ function printdbg(s) { if (0) serial.println(s) }
const WAV_FORMATS = ["LPCM", "ADPCM"]
const WAV_CHANNELS = ["Mono", "Stereo", "3ch", "Quad", "4.1", "5.1", "6.1", "7.1"]
const interactive = exec_args[2] && exec_args[2].toLowerCase() == "/i"
const interactive = exec_args[2] && exec_args[2].toLowerCase() == "-i"
const seqread = require("seqread")
const pcm = require("pcm")

View File

@@ -8,7 +8,7 @@ if (exec_args[1] === undefined) {
return 1;
}
let noNewFile = (exec_args[1] == "/c" || exec_args[1] == "/C");
let noNewFile = (exec_args[1] == "-c" || exec_args[1] == "-C");
let file = files.open(`${_G.shell.resolvePathInput(exec_args[2] || exec_args[1]).full}`)
if (!file.exists && noNewFile) {
printerrln("TOUCH: Can't open "+file.fullPath+" due to IO error");

View File

@@ -5,4 +5,4 @@ rem e.g. set PATH=\home\my-cool-project;$PATH
set KEYBOARD=us_qwerty
rem this line specifies which shell to be presented after the boot precess:
command /fancy
command -fancy