Skip to content

Commit

Permalink
Add options from json ability to each command to each command
Browse files Browse the repository at this point in the history
  • Loading branch information
MilapNaik committed Mar 5, 2024
1 parent 1d75b10 commit 48d07d9
Show file tree
Hide file tree
Showing 18 changed files with 111 additions and 753 deletions.
11 changes: 6 additions & 5 deletions src/commands/ConvertToSquashfsCommand.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { rokuDeploy } from '../index';
import { rokuDeploy, util } from '../index';

export class ConvertToSquashfsCommand {
async run(args) {
await rokuDeploy.convertToSquashfs({
host: args.host,
password: args.password
});
let options = {
...util.getOptionsFromJson(args),
...args
};
await rokuDeploy.convertToSquashfs(options);
}
}
13 changes: 6 additions & 7 deletions src/commands/CreateSignedPackageCommand.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { rokuDeploy } from '../index';
import { rokuDeploy, util } from '../index';

export class CreateSignedPackageCommand {
async run(args) {
await rokuDeploy.createSignedPackage({
host: args.host,
password: args.password,
signingPassword: args.signingPassword,
stagingDir: args.stagingDir
});
let options = {
...util.getOptionsFromJson(args),
...args
};
await rokuDeploy.createSignedPackage(options);
}
}
11 changes: 6 additions & 5 deletions src/commands/DeleteDevChannelCommand.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { rokuDeploy } from '../index';
import { rokuDeploy, util } from '../index';

export class DeleteDevChannelCommand {
async run(args) {
await rokuDeploy.deleteDevChannel({
host: args.host,
password: args.password
});
let options = {
...util.getOptionsFromJson(args),
...args
};
await rokuDeploy.deleteDevChannel(options);
}
}
5 changes: 0 additions & 5 deletions src/commands/ExecCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@ export class ExecCommand {
...this.options
};

// Possibilities:
// 'stage|zip'
// 'stage|zip|delete|close|sideload'
// 'close|rekey|stage|zip|delete|close|sideload|squash|sign'

if (this.actions.includes('stage')) {
await rokuDeploy.stage(this.options);
}
Expand Down
10 changes: 6 additions & 4 deletions src/commands/GetDevIdCommand.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { rokuDeploy } from '../index';
import { rokuDeploy, util } from '../index';

export class GetDevIdCommand {
async run(args) {
await rokuDeploy.getDevId({
host: args.host
});
let options = {
...util.getOptionsFromJson(args),
...args
};
await rokuDeploy.getDevId(options);
}
}
8 changes: 5 additions & 3 deletions src/commands/GetDeviceInfoCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ import { util } from '../util';

export class GetDeviceInfoCommand {
async run(args) {
const outputPath = await rokuDeploy.getDeviceInfo({
host: args.host
});
let options = {
...util.getOptionsFromJson(args),
...args
};
const outputPath = await rokuDeploy.getDeviceInfo(options);
console.log(util.objectToTableString(outputPath));
}
}
11 changes: 6 additions & 5 deletions src/commands/GetOutputPkgFilePathCommand.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { rokuDeploy } from '../index';
import { rokuDeploy, util } from '../index';

export class GetOutputPkgFilePathCommand {
run(args) {
let options = {
...util.getOptionsFromJson(args),
...args
};
// eslint-disable-next-line @typescript-eslint/dot-notation
const outputPath = rokuDeploy['getOutputPkgPath']({
outFile: args.outFile,
outDir: args.outDir
});
const outputPath = rokuDeploy['getOutputPkgPath'](options); //TODO fix this?
console.log(outputPath);
}
}
11 changes: 6 additions & 5 deletions src/commands/GetOutputZipFilePathCommand.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { rokuDeploy } from '../index';
import { rokuDeploy, util } from '../index';

export class GetOutputZipFilePathCommand {
run(args) {
let options = {
...util.getOptionsFromJson(args),
...args
};
// eslint-disable-next-line @typescript-eslint/dot-notation
const outputPath = rokuDeploy['getOutputZipFilePath']({
outFile: args.outFile,
outDir: args.outDir
});
const outputPath = rokuDeploy['getOutputZipFilePath'](options);
console.log(outputPath);
}
}
8 changes: 6 additions & 2 deletions src/commands/KeyDownCommand.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import { rokuDeploy } from '../index';
import { rokuDeploy, util } from '../index';

export class KeyDownCommand {
async run(args) {
await rokuDeploy.keyDown(args.text);
let options = {
...util.getOptionsFromJson(args),
...args
};
await rokuDeploy.keyDown(options);
}
}
8 changes: 6 additions & 2 deletions src/commands/KeyPressCommand.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import { rokuDeploy } from '../index';
import { rokuDeploy, util } from '../index';

export class KeyPressCommand {
async run(args) {
await rokuDeploy.keyPress(args.text);
let options = {
...util.getOptionsFromJson(args),
...args
};
await rokuDeploy.keyPress(options);
}
}
8 changes: 6 additions & 2 deletions src/commands/KeyUpCommand.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import { rokuDeploy } from '../index';
import { rokuDeploy, util } from '../index';

export class KeyUpCommand {
async run(args) {
await rokuDeploy.keyUp(args.text);
let options = {
...util.getOptionsFromJson(args),
...args
};
await rokuDeploy.keyUp(options);
}
}
11 changes: 6 additions & 5 deletions src/commands/PrepublishCommand.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { rokuDeploy } from '../index';
import { rokuDeploy, util } from '../index';

export class PrepublishCommand {
async run(args) {
await rokuDeploy.stage({
stagingDir: args.stagingDir,
rootDir: args.rootDir
});
let options = {
...util.getOptionsFromJson(args),
...args
};
await rokuDeploy.stage(options);
}
}
13 changes: 6 additions & 7 deletions src/commands/PublishCommand.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { rokuDeploy } from '../index';
import { rokuDeploy, util } from '../index';

export class PublishCommand {
async run(args) {
await rokuDeploy.sideload({
host: args.host,
password: args.password,
outDir: args.outDir,
outFile: args.outFile
});
let options = {
...util.getOptionsFromJson(args),
...args
};
await rokuDeploy.sideload(options);
}
}
15 changes: 6 additions & 9 deletions src/commands/RekeyDeviceCommand.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
import { rokuDeploy } from '../index';
import { rokuDeploy, util } from '../index';

export class RekeyDeviceCommand {
async run(args) {
await rokuDeploy.rekeyDevice({
host: args.host,
password: args.password,
rekeySignedPackage: args.rekeySignedPackage,
signingPassword: args.signingPassword,
rootDir: args.rootDir,
devId: args.devId
});
let options = {
...util.getOptionsFromJson(args),
...args
};
await rokuDeploy.rekeyDevice(options);
}
}
9 changes: 6 additions & 3 deletions src/commands/SendTextCommand.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import { rokuDeploy } from '../index';
import { rokuDeploy, util } from '../index';

export class SendTextCommand {
// this.options = getDefaultArgsFromJson(this.configPath ?? `${cwd}/rokudeploy.json`);TODO
async run(args) {
await rokuDeploy.sendText(args.text);
let options = {
...util.getOptionsFromJson(args),
...args
};
await rokuDeploy.sendText(options);
}
}
11 changes: 6 additions & 5 deletions src/commands/TakeScreenshotCommand.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { rokuDeploy } from '../index';
import { rokuDeploy, util } from '../index';

export class TakeScreenshotCommand {
async run(args) {
await rokuDeploy.captureScreenshot({
host: args.host,
password: args.password
});
let options = {
...util.getOptionsFromJson(args),
...args
};
await rokuDeploy.captureScreenshot(options);
}
}
11 changes: 6 additions & 5 deletions src/commands/ZipCommand.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { rokuDeploy } from '../index';
import { rokuDeploy, util } from '../index';

export class ZipCommand {
async run(args) {
await rokuDeploy.zip({
stagingDir: args.stagingDir,
outDir: args.outDir
});
let options = {
...util.getOptionsFromJson(args),
...args
};
await rokuDeploy.zip(options);
}
}
Loading

0 comments on commit 48d07d9

Please sign in to comment.