Skip to content
This repository has been archived by the owner on Mar 13, 2021. It is now read-only.

Commit

Permalink
Merge branch 'spec-fixups' of https://github.com/ShipEngine/shipengin…
Browse files Browse the repository at this point in the history
…e-cli into spec-fixups
  • Loading branch information
rkrauskopf committed Sep 3, 2020
2 parents 9aa524f + 3f2c893 commit c07c8c6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 28 deletions.
20 changes: 4 additions & 16 deletions src/commands/index.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,12 @@
import BaseCommand from "../base-command";
import { flags } from "@oclif/command";
import cliBanner from '../core/utils/cli-banner';
import Help from '@oclif/plugin-help';

export default class Index extends BaseCommand {
export default class Index extends Help {
public static description = "Connect CLI";

public static flags = {
help: flags.help({
char: "h",
description: "Show help for commands",
}),
};

// hide the command from help
public static hidden = true;

run(): Promise<void> {
// When the -h flag is present the following line haults execution
this.parse(Index);
this.log(cliBanner());
this._version();
run(): void {
this.showRootHelp()
}
}
19 changes: 9 additions & 10 deletions src/commands/info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { flags } from "@oclif/command";
import { loadApp } from "@shipengine/connect-loader";
import Login from './login';
import { ApiClientErrors } from '../core/api-client'
import Table from 'cli-table';

export default class Info extends BaseCommand {
public static description = "Get the current information about your app";
Expand Down Expand Up @@ -36,16 +37,14 @@ export default class Info extends BaseCommand {
platformApp.id,
);

this.log(
`{
name: ${platformApp.name},
status: ${
paginatedDeployments.items[0]
? paginatedDeployments.items[0].status
: "none"
}
}`,
);
const latestDeployment = paginatedDeployments.items[0];

const table = new Table({
head: ['ID', 'Name', "Type", "Status", "Created At"]
});

table.push([platformApp.id, platformApp.name, platformApp.type, latestDeployment.status, latestDeployment.createdAt])
console.log(table.toString());
} catch (error) {
switch (error.code) {
case "ERR_APP_ERROR":
Expand Down
4 changes: 2 additions & 2 deletions src/core/utils/api-key-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export enum Errors {

/**
* Retrieves a key if it exist in the file system
* @returns {Promise<strig>} A promise w/ the key value
* @returns {Promise<string>} A promise w/ the key value
*/
export async function get(): Promise<string> {
try {
Expand All @@ -35,7 +35,7 @@ export async function get(): Promise<string> {
* Sets a key in the file system
*
* @param {string} apiKey The key that should be set
* @returns {Promise<strig>} A promise with the value of the key that was set
* @returns {Promise<string>} A promise with the value of the key that was set
*/
export async function set(apiKey: string): Promise<string> {
try {
Expand Down

0 comments on commit c07c8c6

Please sign in to comment.