accent-cli
Advanced tools
Comparing version 0.13.2 to 0.13.3
@@ -1,1 +0,1 @@ | ||
{"version":"0.13.2","commands":{"export":{"id":"export","description":"Export files from Accent and write them to your local filesystem","pluginName":"accent-cli","pluginType":"core","aliases":[],"examples":["$ accent export","$ accent export --order-by=key --version=build.myapp.com:0.12.345"],"flags":{"order-by":{"name":"order-by","type":"option","description":"Order of the keys","options":["index","key"],"default":"index"},"version":{"name":"version","type":"option","description":"Fetch a specific version","default":""},"config":{"name":"config","type":"option","description":"Path to the config file","default":"accent.json"}},"args":[]},"format":{"id":"format","description":"Format local files from server. Exit code is 1 if there are errors.","pluginName":"accent-cli","pluginType":"core","aliases":[],"examples":["$ accent format"],"flags":{"order-by":{"name":"order-by","type":"option","description":"Order of the keys","options":["index","key","-index","-key"],"default":"index"},"config":{"name":"config","type":"option","description":"Path to the config file","default":"accent.json"}},"args":[]},"jipt":{"id":"jipt","description":"Export jipt files from Accent and write them to your local filesystem","pluginName":"accent-cli","pluginType":"core","aliases":[],"examples":["$ accent jipt"],"flags":{"config":{"name":"config","type":"option","description":"Path to the config file","default":"accent.json"}},"args":[{"name":"pseudoLanguageName","description":"The pseudo language for in-place-translation-editing","required":true}]},"lint":{"id":"lint","description":"Lint local files and display errors if any. Exit code is 1 if there are errors.","pluginName":"accent-cli","pluginType":"core","aliases":[],"examples":["$ accent lint"],"flags":{"config":{"name":"config","type":"option","description":"Path to the config file","default":"accent.json"}},"args":[]},"stats":{"id":"stats","description":"Fetch stats from the API and display it beautifully","pluginName":"accent-cli","pluginType":"core","aliases":[],"examples":["$ accent stats"],"flags":{"config":{"name":"config","type":"option","description":"Path to the config file","default":"accent.json"}},"args":[]},"sync":{"id":"sync","description":"Sync files in Accent and write them to your local filesystem","pluginName":"accent-cli","pluginType":"core","aliases":[],"examples":["$ accent sync","$ accent sync --dry-run --sync-type=force","$ accent sync --add-translations --merge-type=smart --order-key=key --version=v0.23"],"flags":{"add-translations":{"name":"add-translations","type":"boolean","description":"Add translations in Accent to help translators if you already have translated strings locally","allowNo":false},"dry-run":{"name":"dry-run","type":"boolean","description":"Do not write the file from the export _after_ the operation","allowNo":false},"merge-type":{"name":"merge-type","type":"option","description":"Algorithm to use on existing strings when adding translation","options":["smart","passive","force"],"default":"passive"},"order-by":{"name":"order-by","type":"option","description":"Will be used in the export call as the order of the keys","options":["index","key"],"default":"index"},"sync-type":{"name":"sync-type","type":"option","description":"Algorithm to use on existing strings when syncing the main language","options":["smart","passive"],"default":"smart"},"version":{"name":"version","type":"option","description":"Sync a specific version, the tag needs to exists in Accent first","default":""},"config":{"name":"config","type":"option","description":"Path to the config file","default":"accent.json"}},"args":[]}}} | ||
{"version":"0.13.3","commands":{"export":{"id":"export","description":"Export files from Accent and write them to your local filesystem","pluginName":"accent-cli","pluginType":"core","aliases":[],"examples":["$ accent export","$ accent export --order-by=key --version=build.myapp.com:0.12.345"],"flags":{"order-by":{"name":"order-by","type":"option","description":"Order of the keys","options":["index","key"],"default":"index"},"version":{"name":"version","type":"option","description":"Fetch a specific version","default":""},"config":{"name":"config","type":"option","description":"Path to the config file","default":"accent.json"}},"args":[]},"format":{"id":"format","description":"Format local files from server. Exit code is 1 if there are errors.","pluginName":"accent-cli","pluginType":"core","aliases":[],"examples":["$ accent format"],"flags":{"order-by":{"name":"order-by","type":"option","description":"Order of the keys","options":["index","key","-index","-key"],"default":"index"},"config":{"name":"config","type":"option","description":"Path to the config file","default":"accent.json"}},"args":[]},"jipt":{"id":"jipt","description":"Export jipt files from Accent and write them to your local filesystem","pluginName":"accent-cli","pluginType":"core","aliases":[],"examples":["$ accent jipt"],"flags":{"config":{"name":"config","type":"option","description":"Path to the config file","default":"accent.json"}},"args":[{"name":"pseudoLanguageName","description":"The pseudo language for in-place-translation-editing","required":true}]},"lint":{"id":"lint","description":"Lint local files and display errors if any. Exit code is 1 if there are errors.","pluginName":"accent-cli","pluginType":"core","aliases":[],"examples":["$ accent lint"],"flags":{"config":{"name":"config","type":"option","description":"Path to the config file","default":"accent.json"}},"args":[]},"stats":{"id":"stats","description":"Fetch stats from the API and display it beautifully","pluginName":"accent-cli","pluginType":"core","aliases":[],"examples":["$ accent stats"],"flags":{"config":{"name":"config","type":"option","description":"Path to the config file","default":"accent.json"}},"args":[]},"sync":{"id":"sync","description":"Sync files in Accent and write them to your local filesystem","pluginName":"accent-cli","pluginType":"core","aliases":[],"examples":["$ accent sync","$ accent sync --dry-run --sync-type=force","$ accent sync --add-translations --merge-type=smart --order-key=key --version=v0.23"],"flags":{"add-translations":{"name":"add-translations","type":"boolean","description":"Add translations in Accent to help translators if you already have translated strings locally","allowNo":false},"dry-run":{"name":"dry-run","type":"boolean","description":"Do not write the file from the export _after_ the operation","allowNo":false},"merge-type":{"name":"merge-type","type":"option","description":"Algorithm to use on existing strings when adding translation","options":["smart","passive","force"],"default":"passive"},"order-by":{"name":"order-by","type":"option","description":"Will be used in the export call as the order of the keys","options":["index","key"],"default":"index"},"sync-type":{"name":"sync-type","type":"option","description":"Algorithm to use on existing strings when syncing the main language","options":["smart","passive"],"default":"smart"},"version":{"name":"version","type":"option","description":"Sync a specific version, the tag needs to exists in Accent first","default":""},"config":{"name":"config","type":"option","description":"Path to the config file","default":"accent.json"}},"args":[]}}} |
@@ -6,6 +6,3 @@ import Command from '@oclif/command'; | ||
export declare const configFlag: flags.IOptionFlag<string>; | ||
export default abstract class Base extends Command { | ||
static flags: { | ||
config: flags.IOptionFlag<string>; | ||
}; | ||
export default abstract class extends Command { | ||
projectConfig: ConfigFetcher; | ||
@@ -12,0 +9,0 @@ project?: Project; |
@@ -18,9 +18,15 @@ "use strict"; | ||
}); | ||
class Base extends command_1.default { | ||
const parseConfigFlag = (argv) => { | ||
const configFlag = argv.findIndex((arg) => arg.match('--config')); | ||
if (configFlag >= 0 && !argv[configFlag + 1]) | ||
(0, errors_1.error)('Flag --config expects a value'); | ||
return (configFlag >= 0 ? argv[configFlag + 1] : null) || 'accent.json'; | ||
}; | ||
class default_1 extends command_1.default { | ||
async init() { | ||
const { flags } = this.parse(Base); | ||
this.projectConfig = new config_1.default(flags.config); | ||
const configFlag = parseConfigFlag(this.argv); | ||
this.projectConfig = new config_1.default(configFlag); | ||
const config = this.projectConfig.config; | ||
// Fetch project from the GraphQL API. | ||
cli_ux_1.default.action.start(chalk.white(`Fetch config in ${flags.config}`)); | ||
cli_ux_1.default.action.start(chalk.white(`Fetch config in ${configFlag}`)); | ||
await sleep(1000); | ||
@@ -49,3 +55,2 @@ const fetcher = new project_fetcher_1.default(); | ||
} | ||
exports.default = Base; | ||
Base.flags = { config: exports.configFlag }; | ||
exports.default = default_1; |
@@ -34,3 +34,5 @@ "use strict"; | ||
} | ||
console.log(this.project.logo ? this.project.logo : chalk.bgGreenBright.bold(' ^ '), chalk.white.bold(this.project.name), chalk.dim(' • '), percentageReviewedFormat); | ||
console.log(this.project.logo | ||
? this.project.logo | ||
: chalk.bgGreenBright.black.bold(' ^ '), chalk.white.bold(this.project.name), chalk.dim(' • '), percentageReviewedFormat); | ||
const titleLength = (this.project.logo ? this.project.logo.length + 1 : 0) + | ||
@@ -37,0 +39,0 @@ this.project.name.length + |
{ | ||
"name": "accent-cli", | ||
"version": "0.13.2", | ||
"version": "0.13.3", | ||
"author": "Simon Prévost", | ||
@@ -5,0 +5,0 @@ "description": "Accent CLI", |
@@ -23,3 +23,3 @@ Accent CLI | ||
$ accent (-v|--version|version) | ||
accent-cli/0.13.2 darwin-arm64 node-v16.15.1 | ||
accent-cli/0.13.3 darwin-arm64 node-v16.15.1 | ||
$ accent --help [COMMAND] | ||
@@ -102,3 +102,3 @@ USAGE | ||
_See code: [src/commands/export.ts](https://github.com/mirego/accent/blob/v0.13.2/src/commands/export.ts)_ | ||
_See code: [src/commands/export.ts](https://github.com/mirego/accent/blob/v0.13.3/src/commands/export.ts)_ | ||
@@ -121,3 +121,3 @@ ## `accent format` | ||
_See code: [src/commands/format.ts](https://github.com/mirego/accent/blob/v0.13.2/src/commands/format.ts)_ | ||
_See code: [src/commands/format.ts](https://github.com/mirego/accent/blob/v0.13.3/src/commands/format.ts)_ | ||
@@ -159,3 +159,3 @@ ## `accent help [COMMAND]` | ||
_See code: [src/commands/jipt.ts](https://github.com/mirego/accent/blob/v0.13.2/src/commands/jipt.ts)_ | ||
_See code: [src/commands/jipt.ts](https://github.com/mirego/accent/blob/v0.13.3/src/commands/jipt.ts)_ | ||
@@ -177,3 +177,3 @@ ## `accent lint` | ||
_See code: [src/commands/lint.ts](https://github.com/mirego/accent/blob/v0.13.2/src/commands/lint.ts)_ | ||
_See code: [src/commands/lint.ts](https://github.com/mirego/accent/blob/v0.13.3/src/commands/lint.ts)_ | ||
@@ -195,3 +195,3 @@ ## `accent stats` | ||
_See code: [src/commands/stats.ts](https://github.com/mirego/accent/blob/v0.13.2/src/commands/stats.ts)_ | ||
_See code: [src/commands/stats.ts](https://github.com/mirego/accent/blob/v0.13.3/src/commands/stats.ts)_ | ||
@@ -228,3 +228,3 @@ ## `accent sync` | ||
_See code: [src/commands/sync.ts](https://github.com/mirego/accent/blob/v0.13.2/src/commands/sync.ts)_ | ||
_See code: [src/commands/sync.ts](https://github.com/mirego/accent/blob/v0.13.3/src/commands/sync.ts)_ | ||
<!-- commandsstop --> | ||
@@ -231,0 +231,0 @@ |
77812
1615