ai-renamer
Advanced tools
Comparing version 1.0.13 to 1.0.15
{ | ||
"version": "1.0.13", | ||
"version": "1.0.15", | ||
"license": "GPL-3.0", | ||
@@ -4,0 +4,0 @@ "name": "ai-renamer", |
@@ -43,10 +43,14 @@ # ai-renamer | ||
Options: | ||
-h, --help Show help [boolean] | ||
--version Show version number [boolean] | ||
-c, --set-case Set the case style (e.g. camelCase, pascalCase, | ||
snakeCase, kebabCase) [string] | ||
-m, --set-model Set the Ollama model to use (e.g. gemma2, llama3) [string] | ||
-x, --set-chars Set the maximum number of characters in the new filename | ||
(e.g. 25) [number] | ||
-l, --set-language Set the output language (e.g. English, Turkish) [string] | ||
-h, --help Show help [boolean] | ||
--version Show version number [boolean] | ||
-c, --set-case Set the case style (e.g. camelCase, | ||
pascalCase, snakeCase, kebabCase) [string] | ||
-m, --set-model Set the Ollama model to use (e.g. gemma2, | ||
llama3) [string] | ||
-x, --set-chars Set the maximum number of characters in the | ||
new filename (e.g. 25) [number] | ||
-l, --set-language Set the output language (e.g. English, | ||
Turkish) [string] | ||
-s, --set-include-subdirectories Include files in subdirectories when | ||
processing (e.g: true, false) [boolean] | ||
``` | ||
@@ -53,0 +57,0 @@ |
@@ -50,2 +50,7 @@ const os = require('os') | ||
description: 'Set the output language (e.g. English, Turkish)' | ||
}) | ||
.option('set-include-subdirectories', { | ||
alias: 's', | ||
type: 'string', | ||
description: 'Include files in subdirectories when processing (e.g: true, false)' | ||
}).argv | ||
@@ -61,4 +66,2 @@ | ||
await saveConfig({ config }) | ||
console.log(`⚪ Case set to: ${config.defaultCase}`) | ||
process.exit(1) | ||
} | ||
@@ -69,4 +72,2 @@ | ||
await saveConfig({ config }) | ||
console.log(`⚪ Model set to: ${config.defaultModel}`) | ||
process.exit(1) | ||
} | ||
@@ -77,4 +78,2 @@ | ||
await saveConfig({ config }) | ||
console.log(`⚪ Chars set to: ${config.defaultChars}`) | ||
process.exit(1) | ||
} | ||
@@ -85,7 +84,10 @@ | ||
await saveConfig({ config }) | ||
console.log(`⚪ Language set to: ${config.defaultLanguage}`) | ||
process.exit(1) | ||
} | ||
if (argv['set-include-subdirectories']) { | ||
config.defaultIncludeSubdirectories = argv['set-include-subdirectories'] | ||
await saveConfig({ config }) | ||
} | ||
return { argv, config } | ||
} |
@@ -9,3 +9,2 @@ #!/usr/bin/env node | ||
const [inputPath] = argv._ | ||
const { defaultCase, defaultModel, defaultChars, defaultLanguage } = config | ||
@@ -17,5 +16,5 @@ if (!inputPath) { | ||
await processPath({ inputPath, defaultCase, defaultModel, defaultChars, defaultLanguage }) | ||
await processPath({ ...config, inputPath }) | ||
} | ||
main() |
@@ -1,2 +0,1 @@ | ||
const path = require('path') | ||
const fs = require('fs').promises | ||
@@ -6,4 +5,5 @@ | ||
const chooseModel = require('./chooseModel') | ||
const processDirectory = require('./processDirectory') | ||
module.exports = async ({ inputPath, defaultCase, defaultModel, defaultChars, defaultLanguage }) => { | ||
module.exports = async ({ inputPath, defaultCase, defaultModel, defaultChars, defaultLanguage, defaultIncludeSubdirectories }) => { | ||
try { | ||
@@ -22,17 +22,14 @@ const model = defaultModel || await chooseModel() | ||
const includeSubdirectories = defaultIncludeSubdirectories === 'true' || false | ||
console.log(`⚪ Include subdirectories: ${includeSubdirectories}`) | ||
console.log('--------------------------------------------------') | ||
const stats = await fs.stat(inputPath) | ||
const options = { model, _case, chars, language, includeSubdirectories } | ||
if (stats.isDirectory()) { | ||
const files = await fs.readdir(inputPath) | ||
for (const file of files) { | ||
const filePath = path.join(inputPath, file) | ||
const fileStats = await fs.stat(filePath) | ||
if (fileStats.isFile()) { | ||
await processFile({ model, _case, chars, language, filePath }) | ||
} | ||
} | ||
await processDirectory({ options, inputPath }) | ||
} else if (stats.isFile()) { | ||
await processFile({ model, _case, chars, language, filePath: inputPath }) | ||
await processFile({ ...options, filePath: inputPath }) | ||
} | ||
@@ -39,0 +36,0 @@ } catch (err) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
48997
16
323
88
6