-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: upgrade oclif to v2 #161
Changes from all commits
70d78ee
e387316
8237fbd
afde03a
45bee00
ebc1ead
5d8b92d
a8b849f
21a4d51
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,14 @@ | ||
import { CliUx, Flags } from "@oclif/core"; | ||
import { Args, Flags, ux } from "@oclif/core"; | ||
|
||
import * as ApiV1 from "@/lib/api-v1"; | ||
import BaseCommand from "@/lib/base-command"; | ||
import { formatDate } from "@/lib/helpers/date"; | ||
import { withSpinner } from "@/lib/helpers/request"; | ||
import * as Translation from "@/lib/marshal/translation"; | ||
|
||
export default class TranslationGet extends BaseCommand { | ||
export default class TranslationGet extends BaseCommand<typeof TranslationGet> { | ||
static summary = "Display a single translation from an environment."; | ||
|
||
static description = Translation.translationRefDescription; | ||
|
||
static flags = { | ||
environment: Flags.string({ | ||
default: "development", | ||
|
@@ -21,7 +19,12 @@ export default class TranslationGet extends BaseCommand { | |
}), | ||
}; | ||
|
||
static args = [{ name: "translationRef", required: true }]; | ||
static args = { | ||
translationRef: Args.string({ | ||
description: Translation.translationRefDescription, | ||
required: true, | ||
}), | ||
}; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. One of the main changes in oclif v2. Args are now defined with |
||
|
||
static enableJsonFlag = true; | ||
|
||
|
@@ -82,7 +85,7 @@ export default class TranslationGet extends BaseCommand { | |
}, | ||
]; | ||
|
||
CliUx.ux.table(rows, { | ||
ux.table(rows, { | ||
key: { | ||
header: "Translation", | ||
minWidth: 24, | ||
|
@@ -94,6 +97,6 @@ export default class TranslationGet extends BaseCommand { | |
}); | ||
|
||
this.log(""); | ||
CliUx.ux.styledJSON(JSON.parse(translation.content)); | ||
ux.styledJSON(JSON.parse(translation.content)); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -1,4 +1,4 @@ | ||||||
import { CliUx, Flags } from "@oclif/core"; | ||||||
import { Args, Flags, ux } from "@oclif/core"; | ||||||
|
||||||
import * as ApiV1 from "@/lib/api-v1"; | ||||||
import BaseCommand from "@/lib/base-command"; | ||||||
|
@@ -7,7 +7,7 @@ import { withSpinner } from "@/lib/helpers/request"; | |||||
import * as Conditions from "@/lib/marshal/conditions"; | ||||||
import * as Workflow from "@/lib/marshal/workflow"; | ||||||
|
||||||
export default class WorkflowGet extends BaseCommand { | ||||||
export default class WorkflowGet extends BaseCommand<typeof WorkflowGet> { | ||||||
static summary = "Display a single workflow from an environment."; | ||||||
|
||||||
static flags = { | ||||||
|
@@ -20,7 +20,11 @@ export default class WorkflowGet extends BaseCommand { | |||||
}), | ||||||
}; | ||||||
|
||||||
static args = [{ name: "workflowKey", required: true }]; | ||||||
static args = { | ||||||
workflowKey: Args.string({ | ||||||
required: true, | ||||||
}), | ||||||
}; | ||||||
|
||||||
static enableJsonFlag = true; | ||||||
|
||||||
|
@@ -82,7 +86,7 @@ export default class WorkflowGet extends BaseCommand { | |||||
}, | ||||||
]; | ||||||
|
||||||
CliUx.ux.table(rows, { | ||||||
ux.table(rows, { | ||||||
key: { | ||||||
header: "Workflow", | ||||||
minWidth: 24, | ||||||
|
@@ -95,8 +99,9 @@ export default class WorkflowGet extends BaseCommand { | |||||
|
||||||
this.log(""); | ||||||
|
||||||
// Leading space is there intentionally to align the left padding. | ||||||
if (workflow.steps.length === 0) { | ||||||
return CliUx.ux.log(" This workflow has no steps to display."); | ||||||
return ux.log(" This workflow has no steps to display."); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit:
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah the leading space is there intentionally to align the left spacing in the display. Will add a quick comment. |
||||||
} | ||||||
|
||||||
/* | ||||||
|
@@ -105,7 +110,7 @@ export default class WorkflowGet extends BaseCommand { | |||||
|
||||||
const steps = workflow.steps.map((step, index) => ({ ...step, index })); | ||||||
|
||||||
CliUx.ux.table(steps, { | ||||||
ux.table(steps, { | ||||||
index: { | ||||||
header: "Steps", | ||||||
get: (step) => step.index + 1, | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change allows us to type
this.props
more precisely for each command.