61 lines
1.2 KiB
TypeScript
61 lines
1.2 KiB
TypeScript
export class CliArguments {
|
|
private _extractAudio: boolean
|
|
private _noMTime: boolean
|
|
private _proxy: string
|
|
|
|
constructor(extractAudio = false, noMTime = true) {
|
|
this._extractAudio = extractAudio
|
|
this._noMTime = noMTime
|
|
this._proxy = ""
|
|
}
|
|
|
|
public get extractAudio(): boolean {
|
|
return this._extractAudio
|
|
}
|
|
|
|
public toggleExtractAudio() {
|
|
this._extractAudio = !this._extractAudio
|
|
return this
|
|
}
|
|
|
|
public disableExtractAudio() {
|
|
this._extractAudio = false
|
|
return this
|
|
}
|
|
|
|
public get noMTime(): boolean {
|
|
return this._noMTime
|
|
}
|
|
|
|
public toggleNoMTime() {
|
|
this._noMTime = !this._noMTime
|
|
return this
|
|
}
|
|
|
|
public toString(): string {
|
|
let args = ''
|
|
|
|
if (this._extractAudio) {
|
|
args += '-x '
|
|
}
|
|
|
|
if (this._noMTime) {
|
|
args += '--no-mtime '
|
|
}
|
|
|
|
return args.trim()
|
|
}
|
|
|
|
public fromString(str: string): CliArguments {
|
|
if (str) {
|
|
if (str.includes('-x')) {
|
|
this._extractAudio = true
|
|
}
|
|
|
|
if (str.includes('--no-mtime')) {
|
|
this._noMTime = true
|
|
}
|
|
}
|
|
return this
|
|
}
|
|
} |