[cli] replicate: move source and dest arguments to positional args

This commit is contained in:
Laura Liberda 2021-02-22 16:47:18 +01:00
parent 859f3caf39
commit 359b40cc98
2 changed files with 16 additions and 8 deletions

View file

@ -5,7 +5,7 @@ Copykitku is a tool for replicating issues, merge requests or specific commits,
Example usage:
```
$ copykitku replicate -s https://github.com/ytdl-org/youtube-dl/issues/27483 -d https://git.sakamoto.pl/laudompat/haruhi-dl
$ copykitku replicate https://github.com/ytdl-org/youtube-dl/issues/27483 https://git.sakamoto.pl/laudompat/haruhi-dl
Replicated successfully: https://git.sakamoto.pl/laudompat/haruhi-dl/-/issues/39
```

View file

@ -10,9 +10,6 @@ export default class Replicate extends Command {
static flags = {
help: flags.help({ char: 'h' }),
source: flags.string({ char: 's', required: true }),
dest: flags.string({ char: 'd', required: true }),
destBranch: flags.string({
description: 'name of the new branch (optional for MRs, required for commits)',
}),
@ -30,15 +27,26 @@ export default class Replicate extends Command {
}),
};
static args = [];
static args = [
{
name: 'source',
required: true,
description: 'the thing you want to replicate',
},
{
name: 'dest',
required: true,
description: 'where you want the thing to be replicated',
},
];
async run() {
const { flags } = this.parse(Replicate);
const { flags, args } = this.parse(Replicate);
const { destBranch, doNotCommit, remote, targetBranch } = flags;
const sourcePath = parsePath(flags.source);
const destPath = parsePath(flags.dest);
const sourcePath = parsePath(args.source);
const destPath = parsePath(args.dest);
assert(sourcePath.entityID, 'Source must be a repo element, not a repo itself');