accent-cli
Advanced tools
Comparing version 0.9.0 to 0.9.1
@@ -1,1 +0,1 @@ | ||
{"version":"0.9.0","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"],"flags":{"order-by":{"name":"order-by","type":"option","description":"Will be used in the export call as the order of the keys","options":["index","key-asc"],"default":"index"}},"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":{},"args":[{"name":"pseudoLanguageName","description":"The pseudo language for in-place-translation-editing","required":true}]},"stats":{"id":"stats","description":"Fetch stats from the API and display it beautifully","pluginName":"accent-cli","pluginType":"core","aliases":[],"examples":["$ accent stats"],"flags":{},"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"],"flags":{"add-translations":{"name":"add-translations","type":"boolean","description":"Add translations in Accent to help translators if you already have translated strings","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":"Will be used in the add translations call as the \"merge_type\" param","options":["smart","passive","force"],"default":"smart"},"order-by":{"name":"order-by","type":"option","description":"Will be used in the export call as the order of the keys","options":["index","key-asc"],"default":"index"},"sync-type":{"name":"sync-type","type":"option","description":"Will be used in the sync call as the \"sync_type\" param","options":["smart","passive"],"default":"smart"}},"args":[]}}} | ||
{"version":"0.9.1","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"],"flags":{"order-by":{"name":"order-by","type":"option","description":"Will be used in the export call as the order of the keys","options":["index","key-asc"],"default":"index"}},"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":{},"args":[{"name":"pseudoLanguageName","description":"The pseudo language for in-place-translation-editing","required":true}]},"stats":{"id":"stats","description":"Fetch stats from the API and display it beautifully","pluginName":"accent-cli","pluginType":"core","aliases":[],"examples":["$ accent stats"],"flags":{},"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"],"flags":{"add-translations":{"name":"add-translations","type":"boolean","description":"Add translations in Accent to help translators if you already have translated strings","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":"Will be used in the add translations call as the \"merge_type\" param","options":["smart","passive","force"],"default":"smart"},"order-by":{"name":"order-by","type":"option","description":"Will be used in the export call as the order of the keys","options":["index","key-asc"],"default":"index"},"sync-type":{"name":"sync-type","type":"option","description":"Will be used in the sync call as the \"sync_type\" param","options":["smart","passive"],"default":"smart"}},"args":[]}}} |
@@ -107,3 +107,7 @@ "use strict"; | ||
} | ||
return path.basename(file).replace(path.extname(file), ''); | ||
const basename = path.basename(file).replace(path.extname(file), ''); | ||
if (config.namePattern === document_config_1.NamePattern.fileWithSlugSuffix) { | ||
return basename.replace(path.extname(basename), ''); | ||
} | ||
return basename; | ||
} | ||
@@ -121,5 +125,9 @@ encodeQuery(params) { | ||
return config; | ||
const pattern = config.target.match(/\%slug\%\//) || !config.source.match(/\//) | ||
? document_config_1.NamePattern.file | ||
: document_config_1.NamePattern.parentDirectory; | ||
let pattern = document_config_1.NamePattern.parentDirectory; | ||
if (config.target.match(/\%slug\%\//) || !config.source.match(/\//)) { | ||
pattern = document_config_1.NamePattern.file; | ||
} | ||
if (config.target.match(/\.\%slug\%\./)) { | ||
pattern = document_config_1.NamePattern.fileWithSlugSuffix; | ||
} | ||
config.namePattern = pattern; | ||
@@ -126,0 +134,0 @@ return config; |
@@ -11,2 +11,3 @@ export declare enum Hooks { | ||
file = "file", | ||
fileWithSlugSuffix = "fileWithSlugSuffix", | ||
parentDirectory = "parentDirectory" | ||
@@ -13,0 +14,0 @@ } |
@@ -15,3 +15,4 @@ "use strict"; | ||
NamePattern["file"] = "file"; | ||
NamePattern["fileWithSlugSuffix"] = "fileWithSlugSuffix"; | ||
NamePattern["parentDirectory"] = "parentDirectory"; | ||
})(NamePattern = exports.NamePattern || (exports.NamePattern = {})); |
{ | ||
"name": "accent-cli", | ||
"version": "0.9.0", | ||
"version": "0.9.1", | ||
"author": "Simon Prévost", | ||
@@ -5,0 +5,0 @@ "description": "Accent CLI", |
@@ -22,3 +22,3 @@ Accent CLI | ||
$ accent (-v|--version|version) | ||
accent-cli/0.9.0 darwin-x64 node-v10.14.2 | ||
accent-cli/0.9.1 darwin-x64 node-v10.14.2 | ||
$ accent --help [COMMAND] | ||
@@ -96,3 +96,3 @@ USAGE | ||
_See code: [src/commands/export.ts](https://github.com/mirego/accent/blob/v0.9.0/src/commands/export.ts)_ | ||
_See code: [src/commands/export.ts](https://github.com/mirego/accent/blob/v0.9.1/src/commands/export.ts)_ | ||
@@ -131,3 +131,3 @@ ## `accent help [COMMAND]` | ||
_See code: [src/commands/jipt.ts](https://github.com/mirego/accent/blob/v0.9.0/src/commands/jipt.ts)_ | ||
_See code: [src/commands/jipt.ts](https://github.com/mirego/accent/blob/v0.9.1/src/commands/jipt.ts)_ | ||
@@ -146,3 +146,3 @@ ## `accent stats` | ||
_See code: [src/commands/stats.ts](https://github.com/mirego/accent/blob/v0.9.0/src/commands/stats.ts)_ | ||
_See code: [src/commands/stats.ts](https://github.com/mirego/accent/blob/v0.9.1/src/commands/stats.ts)_ | ||
@@ -173,3 +173,3 @@ ## `accent sync` | ||
_See code: [src/commands/sync.ts](https://github.com/mirego/accent/blob/v0.9.0/src/commands/sync.ts)_ | ||
_See code: [src/commands/sync.ts](https://github.com/mirego/accent/blob/v0.9.1/src/commands/sync.ts)_ | ||
<!-- commandsstop --> | ||
@@ -176,0 +176,0 @@ |
51792
1048