Skip to content

Commit

Permalink
fix opening of files provided with --config-path (#88)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rogdham authored Oct 8, 2023
1 parent 21134fc commit 83ad426
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions bin/locize
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ program
.option('-C, --config-path <configPath>', `Specify the path to the optional locize config file (default: ${configInWorkingDirectory} or ${configInHome})`)
.action((options) => {
try {
config = ini.parse(fs.readFileSync(options.configPath)) || config;
config = ini.parse(fs.readFileSync(options.configPath, 'utf-8')) || config;
} catch (e) {}

const addPath = options.addPath || config.addPath || addPathUrl;
Expand Down Expand Up @@ -113,7 +113,7 @@ program
.option('-C, --config-path <configPath>', `Specify the path to the optional locize config file (default: ${configInWorkingDirectory} or ${configInHome})`)
.action((namespace, key, value, options) => {
try {
config = ini.parse(fs.readFileSync(options.configPath)) || config;
config = ini.parse(fs.readFileSync(options.configPath, 'utf-8')) || config;
} catch (e) {}

const apiKey = options.apiKey || config.apiKey || process.env.LOCIZE_API_KEY || process.env.LOCIZE_KEY;
Expand Down Expand Up @@ -172,7 +172,7 @@ program
.option('-C, --config-path <configPath>', `Specify the path to the optional locize config file (default: ${configInWorkingDirectory} or ${configInHome})`)
.action((namespace, key, options) => {
try {
config = ini.parse(fs.readFileSync(options.configPath)) || config;
config = ini.parse(fs.readFileSync(options.configPath, 'utf-8')) || config;
} catch (e) {}

const apiKey = options.apiKey || config.apiKey || process.env.LOCIZE_API_KEY || process.env.LOCIZE_KEY;
Expand Down Expand Up @@ -240,7 +240,7 @@ program
.option('-C, --config-path <configPath>', `Specify the path to the optional locize config file (default: ${configInWorkingDirectory} or ${configInHome})`)
.action((options) => {
try {
config = ini.parse(fs.readFileSync(options.configPath)) || config;
config = ini.parse(fs.readFileSync(options.configPath, 'utf-8')) || config;
} catch (e) {}

const projectId = options.projectId || config.projectId || process.env.LOCIZE_PROJECTID || process.env.LOCIZE_PID;
Expand Down Expand Up @@ -309,7 +309,7 @@ program
.option('-C, --config-path <configPath>', `Specify the path to the optional locize config file (default: ${configInWorkingDirectory} or ${configInHome})`)
.action((namespace, key, options) => {
try {
config = ini.parse(fs.readFileSync(options.configPath)) || config;
config = ini.parse(fs.readFileSync(options.configPath, 'utf-8')) || config;
} catch (e) {}

const projectId = options.projectId || config.projectId || process.env.LOCIZE_PROJECTID || process.env.LOCIZE_PID;
Expand Down Expand Up @@ -376,7 +376,7 @@ program
.option('-C, --config-path <configPath>', `Specify the path to the optional locize config file (default: ${configInWorkingDirectory} or ${configInHome})`)
.action((options) => {
try {
config = ini.parse(fs.readFileSync(options.configPath)) || config;
config = ini.parse(fs.readFileSync(options.configPath, 'utf-8')) || config;
} catch (e) {}

const getPath = options.getPath || config.getPath || options.addPath || config.addPath || getPathUrl;
Expand Down Expand Up @@ -470,7 +470,7 @@ program
.option('-C, --config-path <configPath>', `Specify the path to the optional locize config file (default: ${configInWorkingDirectory} or ${configInHome})`)
.action((options) => {
try {
config = ini.parse(fs.readFileSync(options.configPath)) || config;
config = ini.parse(fs.readFileSync(options.configPath, 'utf-8')) || config;
} catch (e) {}

const getPath = options.getPath || config.getPath || options.addPath || config.addPath || getPathUrl;
Expand Down Expand Up @@ -542,7 +542,7 @@ program
.option('-C, --config-path <configPath>', `Specify the path to the optional locize config file (default: ${configInWorkingDirectory} or ${configInHome})`)
.action((fromVersion, options) => {
try {
config = ini.parse(fs.readFileSync(options.configPath)) || config;
config = ini.parse(fs.readFileSync(options.configPath, 'utf-8')) || config;
} catch (e) {}

const apiKey = options.apiKey || config.apiKey || process.env.LOCIZE_API_KEY || process.env.LOCIZE_KEY;
Expand Down Expand Up @@ -590,7 +590,7 @@ program
.option('-C, --config-path <configPath>', `Specify the path to the optional locize config file (default: ${configInWorkingDirectory} or ${configInHome})`)
.action((options) => {
try {
config = ini.parse(fs.readFileSync(options.configPath)) || config;
config = ini.parse(fs.readFileSync(options.configPath, 'utf-8')) || config;
} catch (e) {}

const apiKey = options.apiKey || config.apiKey || process.env.LOCIZE_API_KEY || process.env.LOCIZE_KEY;
Expand Down Expand Up @@ -637,7 +637,7 @@ program
.option('-C, --config-path <configPath>', `Specify the path to the optional locize config file (default: ${configInWorkingDirectory} or ${configInHome})`)
.action((namespace, options) => {
try {
config = ini.parse(fs.readFileSync(options.configPath)) || config;
config = ini.parse(fs.readFileSync(options.configPath, 'utf-8')) || config;
} catch (e) {}

const apiKey = options.apiKey || config.apiKey || process.env.LOCIZE_API_KEY || process.env.LOCIZE_KEY;
Expand Down Expand Up @@ -685,7 +685,7 @@ program
.option('-C, --config-path <configPath>', `Specify the path to the optional locize config file (default: ${configInWorkingDirectory} or ${configInHome})`)
.action((fileOrDirectory, options) => {
try {
config = ini.parse(fs.readFileSync(options.configPath)) || config;
config = ini.parse(fs.readFileSync(options.configPath, 'utf-8')) || config;
} catch (e) {}

fileOrDirectory = fileOrDirectory || '.';
Expand Down

0 comments on commit 83ad426

Please sign in to comment.