WIP typescript conversion
This commit is contained in:
111
src/cli/args.ts
Normal file
111
src/cli/args.ts
Normal file
@@ -0,0 +1,111 @@
|
||||
import yargs from 'yargs/yargs';
|
||||
import { hideBin } from 'yargs/helpers';
|
||||
|
||||
/**
|
||||
* Parse command line arguments
|
||||
*/
|
||||
export function parseCommandLineArgs() {
|
||||
return yargs(hideBin(process.argv))
|
||||
.usage('Usage: $0 <video_file_path> [options]')
|
||||
.positional('video_file_path', {
|
||||
describe: 'Path to the input video file',
|
||||
type: 'string'
|
||||
})
|
||||
.option('captureIntervalSeconds', {
|
||||
alias: 'i',
|
||||
describe: 'Interval in seconds between frame captures',
|
||||
type: 'number'
|
||||
})
|
||||
.option('contextWindowSize', {
|
||||
alias: 'c',
|
||||
describe: 'Number of frames to keep in context',
|
||||
type: 'number'
|
||||
})
|
||||
// Vision provider options
|
||||
.option('visionProvider', {
|
||||
describe: 'Provider to use for vision AI',
|
||||
type: 'string'
|
||||
})
|
||||
.option('visionModel', {
|
||||
describe: 'Model to use for vision AI',
|
||||
type: 'string'
|
||||
})
|
||||
// TTS provider options
|
||||
.option('ttsProvider', {
|
||||
describe: 'Provider to use for text-to-speech',
|
||||
type: 'string'
|
||||
})
|
||||
.option('ttsModel', {
|
||||
alias: 'm',
|
||||
describe: 'TTS model to use',
|
||||
type: 'string'
|
||||
})
|
||||
.option('ttsVoice', {
|
||||
alias: 'v',
|
||||
describe: 'Voice to use for text-to-speech',
|
||||
type: 'string'
|
||||
})
|
||||
.option('ttsSpeedFactor', {
|
||||
alias: 's',
|
||||
describe: 'Speed factor for the audio playback',
|
||||
type: 'number'
|
||||
})
|
||||
.option('outputDir', {
|
||||
alias: 'o',
|
||||
describe: 'Directory for output files',
|
||||
type: 'string'
|
||||
})
|
||||
.option('tempDir', {
|
||||
alias: 't',
|
||||
describe: 'Directory for temporary files',
|
||||
type: 'string'
|
||||
})
|
||||
.option('batchTimeMode', {
|
||||
alias: 'b',
|
||||
describe: 'Use batch time mode for processing',
|
||||
type: 'boolean'
|
||||
})
|
||||
.option('batchWindowDuration', {
|
||||
describe: 'Duration in seconds for each batch window',
|
||||
type: 'number'
|
||||
})
|
||||
.option('framesInBatch', {
|
||||
describe: 'Number of frames to capture within each batch',
|
||||
type: 'number'
|
||||
})
|
||||
.option('defaultPrompt', {
|
||||
describe: 'Prompt for describing individual frames',
|
||||
type: 'string'
|
||||
})
|
||||
.option('changePrompt', {
|
||||
describe: 'Prompt for describing changes between frames',
|
||||
type: 'string'
|
||||
})
|
||||
.option('batchPrompt', {
|
||||
describe: 'Prompt for describing batches of frames',
|
||||
type: 'string'
|
||||
})
|
||||
.option('estimate', {
|
||||
alias: 'e',
|
||||
describe: 'Only estimate the cost without generating the audio description',
|
||||
type: 'boolean',
|
||||
default: false
|
||||
})
|
||||
.option('config', {
|
||||
alias: 'f',
|
||||
describe: 'Path to JSON config file',
|
||||
type: 'string'
|
||||
})
|
||||
.option('saveConfig', {
|
||||
describe: 'Save current configuration to specified JSON file',
|
||||
type: 'string'
|
||||
})
|
||||
.help()
|
||||
.alias('help', 'h')
|
||||
.example('$0 video.mp4', 'Process a video with default settings')
|
||||
.example('$0 video.mp4 --ttsVoice nova --visionProvider openai', 'Process with custom voice and vision provider')
|
||||
.example('$0 video.mp4 --estimate', 'Only estimate the processing cost')
|
||||
.example('$0 video.mp4 --config myconfig.json', 'Use settings from a config file')
|
||||
.example('$0 video.mp4 --saveConfig myconfig.json', 'Save current settings to a config file')
|
||||
.argv;
|
||||
}
|
Reference in New Issue
Block a user