-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add option to rename empty filenames
- Loading branch information
garzj
committed
Jun 23, 2024
1 parent
22fb904
commit 21930e8
Showing
5 changed files
with
51 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,41 @@ | ||
import { flag, number, option, positional, string } from 'cmd-ts'; | ||
import { ArgParser } from 'cmd-ts/dist/cjs/argparser'; | ||
import { ProvidesHelp } from 'cmd-ts/dist/cjs/helpdoc'; | ||
|
||
export const errorDirArg = positional({ | ||
type: string, | ||
displayName: 'error_dir', | ||
description: 'Failed media will be saved here.', | ||
}); | ||
type ArgTypes = Record<string, ArgParser<any> & Partial<ProvidesHelp>>; | ||
|
||
export const timeoutArg = option({ | ||
type: number, | ||
defaultValue: () => 30000, | ||
short: 't', | ||
long: 'timeout', | ||
description: | ||
'Sets the task timeout in milliseconds that will be passed to ExifTool.', | ||
}); | ||
|
||
export const forceArg = flag({ | ||
short: 'f', | ||
long: 'force', | ||
description: "Forces the operation if the given directories aren't empty.", | ||
}); | ||
|
||
export const skipCorrectionsArg = flag({ | ||
long: 'skip-corrections', | ||
description: 'Skips renaming wrong extensions identified by ExifTool.', | ||
}); | ||
|
||
export const verboseArg = flag({ | ||
short: 'v', | ||
long: 'verbose', | ||
description: 'Enables verbose logging.', | ||
}); | ||
export const commonArgs = { | ||
errorDir: positional({ | ||
type: string, | ||
displayName: 'error_dir', | ||
description: 'Failed media will be saved here.', | ||
}), | ||
force: flag({ | ||
short: 'f', | ||
long: 'force', | ||
description: "Forces the operation if the given directories aren't empty.", | ||
}), | ||
timeout: option({ | ||
type: number, | ||
defaultValue: () => 30000, | ||
short: 't', | ||
long: 'timeout', | ||
description: | ||
'Sets the task timeout in milliseconds that will be passed to ExifTool.', | ||
}), | ||
skipCorrections: flag({ | ||
long: 'skip-corrections', | ||
description: 'Skips renaming wrong extensions identified by ExifTool.', | ||
}), | ||
verbose: flag({ | ||
short: 'v', | ||
long: 'verbose', | ||
description: 'Enables verbose logging.', | ||
}), | ||
renameEmpty: option({ | ||
type: string, | ||
defaultValue: () => '_', | ||
long: 'rename-empty', | ||
description: 'Use this name for empty filenames.', | ||
}), | ||
} satisfies ArgTypes; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters