Skip to content

Commit

Permalink
improvement(cli): display hint on missing action error (#6279)
Browse files Browse the repository at this point in the history
Suggest to use command to get the available actions.
  • Loading branch information
vvagaytsev authored Jul 10, 2024
1 parent 4f8a2d6 commit 861a7ee
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion core/src/graph/config-graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import type { TestAction } from "../actions/test.js"
import type { GroupConfig } from "../config/group.js"
import minimatch from "minimatch"
import { GraphError } from "../exceptions.js"
import { styles } from "../logger/styles.js"

export type DependencyRelationFilterFn = (node: ConfigGraphNode) => boolean

Expand Down Expand Up @@ -153,12 +154,15 @@ export abstract class BaseConfigGraph<
getModule(name: string, includeDisabled?: boolean) {
return this.moduleGraph.getModule(name, includeDisabled)
}

getModules(params: GetManyParams = {}) {
return this.moduleGraph.getModules(params)
}

withDependantModules(modules: GardenModule[]) {
return this.moduleGraph.withDependantModules(modules)
}

// and sanity...
//////////////////

Expand Down Expand Up @@ -252,7 +256,11 @@ export abstract class BaseConfigGraph<
const missing = difference(names, foundNames)

throw new GraphError({
message: `Could not find one or more ${kind} actions: ${naturalList(missing)}`,
message: dedent`
Could not find one or more ${kind} actions: ${naturalList(missing)}.
To get the list of the available ${styles.accent(kind)} actions please use ${styles.command(`get ${kind.toLowerCase()}s`)} command.
To get the list of all actions please use ${styles.command("get actions")} command.
`,
})
}

Expand Down

0 comments on commit 861a7ee

Please sign in to comment.