Skip to content

Commit

Permalink
Added --version, bumped version to 1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
gmegidish committed Sep 23, 2020
1 parent a33adf1 commit f127b31
Show file tree
Hide file tree
Showing 20 changed files with 74 additions and 95 deletions.
20 changes: 17 additions & 3 deletions app/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const console_stamp = require('console-stamp');

const options_definitions = [
{name: 'help', alias: 'h', type: Boolean},
{name: 'version', alias: 'v', type: Boolean},
{name: 'project-id', type: Number},
{name: 'user', type: String},
{name: 'api-key', type: String},
Expand All @@ -21,15 +22,22 @@ const options_definitions = [
{name: 'overwrite'},
];

console_stamp(console, 'HH:MM:ss.l');

class SessionsTool {
async run() {
const options = new Options(options_definitions);
if (options.containsHelp()) {
this.help();
return;
}

if (options.containsVersion()) {
this.version();
return;
}

console_stamp(console, 'HH:MM:ss.l');

console.log("Fetching new sessions...");
const predicates = makeProjectPredicates(options);
const sessions = await fetchSessions(predicates, options);
if (sessions.length === 0) {
Expand All @@ -38,10 +46,12 @@ class SessionsTool {
}

if (options.contains('logs')) {
console.log("Fetching logs");
await logs(sessions, options);
}

if (options.contains('screenshots') || options.contains('video')) {
console.log("Fetching session screenshots");
await screenshots(sessions, options);
}
}
Expand All @@ -51,9 +61,13 @@ class SessionsTool {
console.log("");
console.log("This tool downloads screenshots and/or logs from recorded TestFairy sessions. Use this to download data to analyze");
console.log("sessions with your own toolchain or to import to your own analytics systems.");
process.exit(1);
}

version() {
console.log("fetch-sessions-tool version 1.3.0");
}
}

const tool = new SessionsTool();
tool.run().catch((error: Error) => { console.error(error.message); tool.help(); })

4 changes: 4 additions & 0 deletions app/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ export class Options {
return isEmpty(this.options) || this.options.help;
}

containsVersion() {
return this.options.version;
}

contains(key: string) {
return this.options[key] !== undefined
}
Expand Down
3 changes: 2 additions & 1 deletion app/screenshotCallback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ export class Video implements ScreenshotCallbackCommand {
return;
}

console.log(`All ${downloads.length} images for ${session} have been downloaded. Creating video ${filename}`);
console.log(`All ${downloads.length} images for ${session} have been downloaded.`);
console.log(`Creating video ${filename}`);

const command = `${ffmpeg.path} -r 1 -pattern_type glob -i '${filesPath}/*.jpg' -c:v libx264 ${filename}`;
exec.exec(command, (err, stdout, stderr) => {
Expand Down
1 change: 0 additions & 1 deletion js/aes-encryption.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion js/aes-encryption.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 13 additions & 2 deletions js/app.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion js/app.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 7 additions & 20 deletions js/helpers.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit f127b31

Please sign in to comment.