Improve CLI export/import and add missing files

This commit is contained in:
Jan Oberhauser
2021-01-21 10:52:33 +01:00
parent 144de3f24b
commit 910c0eaa7a
4 changed files with 227 additions and 0 deletions

View File

@@ -22,6 +22,7 @@ export class ExportCredentialsCommand extends Command {
`$ n8n export:credentials --all`,
`$ n8n export:credentials --id=5 --output=file.json`,
`$ n8n export:credentials --all --output=backups/latest/`,
`$ n8n export:credentials --backup --output=backups/latest/`,
];
static flags = {
@@ -29,10 +30,14 @@ export class ExportCredentialsCommand extends Command {
all: flags.boolean({
description: 'Export all credentials',
}),
backup: flags.boolean({
description: 'Sets --all --pretty --separate for simple backups. Only --output has to be set additionally.',
}),
id: flags.string({
description: 'The ID of the credential to export',
}),
output: flags.string({
char: 'o',
description: 'Output file name or directory if using separate files',
}),
pretty: flags.boolean({
@@ -46,6 +51,12 @@ export class ExportCredentialsCommand extends Command {
async run() {
const { flags } = this.parse(ExportCredentialsCommand);
if (flags.backup) {
flags.all = true;
flags.pretty = true;
flags.separate = true;
}
if (!flags.all && !flags.id) {
GenericHelpers.logOutput(`Either option "--all" or "--id" have to be set!`);
return;