Skip to content

Commit fa72a56

Browse files
committed
chore(commands/github): refactor subcommand strings
1 parent 656205f commit fa72a56

File tree

3 files changed

+18
-11
lines changed

3 files changed

+18
-11
lines changed

src/commands/github/actions.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export const execute = async () => {
2323

2424
const [owner, repo] = await gitHubRepoOwnerAndNameFromRemote(remote)
2525

26-
logger.info(string('command.github.actionActions', owner, repo))
26+
logger.info(string('command.github.actions.action', owner, repo))
2727

2828
await openGitHubActions(owner, repo, {
2929
branch,
@@ -35,7 +35,7 @@ function preferFirstString(...items: any[]) {
3535
return items.find(it => typeof it === 'string' && it)
3636
}
3737

38-
export const description = string('command.github.actionsDescription')
38+
export const description = string('command.github.actions.description')
3939

4040
export const aliases = ['a', 'action']
4141

src/commands/github/pull-request.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,12 @@ export const execute = async () => {
105105
}
106106

107107
logger.debug(`PR @ ${targetOwner}/${targetName}:${targetBranch} <- ${fromOwner}/${fromName}:${fromBranch}`)
108-
logger.info(string('command.github.actionPr', targetBranch, targetRemote, fromBranch, fromRemote))
108+
logger.info(string('command.github.pullRequest.action', targetBranch, targetRemote, fromBranch, fromRemote))
109109

110110
await openGitHubPullRequest(targetOwner, targetName, targetBranch, fromOwner, fromName, fromBranch)
111111
}
112112

113-
export const description = string('command.github.pullRequestDescription')
113+
export const description = string('command.github.pullRequest.description')
114114

115115
export const aliases = ['pr', 'pullrequest']
116116

src/strings.ts

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,18 @@ const STRINGS = {
2424
},
2525
github: {
2626
description: 'Things related to the Hub- shit. Walked myself right into that one.',
27-
pullRequestDescription: 'Open a pull request. What did you expect?',
28-
actionsDescription: 'Just pushed your changes? Want to watch the deployment fail?',
27+
pullRequest: {
28+
description: 'Open a pull request. What did you expect?',
29+
action: (tb: string, tr: string, fb: string, fr: string) =>
30+
chalkTemplate`Fine. Making a PR ${tr}/${tb} <- ${fr}/${fb}. Hope it gets closed, or a ton conflicts.`,
31+
},
32+
actions: {
33+
description: 'Just pushed your changes? Want to watch the deployment fail?',
34+
action: (owner: string, repo: string) =>
35+
chalkTemplate`Opening Actions page for ${owner}/${repo}. Hope your workflows fail.`,
36+
},
2937
noSubcommand: "You're ordering a category instead of an item. Pick one of the subcommands.",
3038
invalidSubcommand: "That doesn't exist on the menu. Try again.",
31-
actionPr: (tb: string, tr: string, fb: string, fr: string) =>
32-
chalkTemplate`Fine. Making a PR ${tr}/${tb} <- ${fr}/${fb}. Hope it gets closed, or a ton conflicts.`,
33-
actionActions: (owner: string, repo: string) =>
34-
chalkTemplate`Opening Actions page for ${owner}/${repo}. Hope your workflows fail.`,
3539
noActiveLocalBranch: [
3640
'Are you not on a branch? What are you doing?',
3741
"I haven't been trained to deal with this. No active brach?",
@@ -197,7 +201,10 @@ const STRINGS = {
197201
// like: never ?? never => never
198202
type NeverCoalesce<T, Y> = [T] extends [never] ? Y : T
199203

200-
export type StringDict = Record<string, Stringifiable | RandomizableStringifiable>
204+
export interface StringDict {
205+
[key: string]: Stringifiable | RandomizableStringifiable | StringDict
206+
}
207+
201208
export type StringifableDynamic = (...args: any[]) => string
202209
export type Stringifiable = string | StringifableDynamic
203210
export type RandomizableStringifiable = Array<Stringifiable>

0 commit comments

Comments
 (0)