Skip to content

Commit

Permalink
fix: Fix CLI query command TypeError
Browse files Browse the repository at this point in the history
Switch to using named args property now that it is explicitly defined in the command.
  • Loading branch information
peterjroberts committed Nov 9, 2020
1 parent c683c8e commit b8b3685
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/commands/QueryCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@ export class QueryCommand implements yargs.CommandModule {

// create a query runner and execute query using it
queryRunner = connection.createQueryRunner();
console.log(chalk.green("Running query: ") + PlatformTools.highlightSql(args._[1]));
const queryResult = await queryRunner.query(args._[1]);
const query = args.query as string;
console.log(chalk.green("Running query: ") + PlatformTools.highlightSql(query));
const queryResult = await queryRunner.query(query);

if (typeof queryResult === "undefined") {
console.log(chalk.green("Query has been executed. No result was returned."));
Expand Down

0 comments on commit b8b3685

Please sign in to comment.