@@ -39,7 +39,7 @@ function enterAltBufferMode() {
3939 console . log ( "\x1b[?1049h" )
4040}
4141
42- export function usage ( cmd = "dashboard" ) {
42+ export function usage ( cmd : string ) {
4343 return `Usage: codeflare ${ cmd } ${ validKinds ( ) . join ( "|" ) } [<jobId>|-N]`
4444}
4545
@@ -67,7 +67,7 @@ async function lastNJob(profile: string, N: number) {
6767 }
6868}
6969
70- export async function jobIdFrom ( args : Arguments < Options > , cmd = "dashboard" , offset = 2 ) {
70+ export async function jobIdFrom ( args : Arguments < Options > , cmd : string , offset = 2 ) {
7171 const profile = args . parsedOptions . p || ( await import ( "madwizard" ) . then ( ( _ ) => _ . Profiles . lastUsed ( ) ) )
7272
7373 const jobIdFromCommandLine = args . argvNoOptions [ args . argvNoOptions . indexOf ( cmd ) + offset ]
@@ -80,19 +80,19 @@ export async function jobIdFrom(args: Arguments<Options>, cmd = "dashboard", off
8080 return { jobId, profile }
8181}
8282
83- export default async function dashboard ( args : Arguments < Options > ) {
83+ export default async function dashboard ( args : Arguments < Options > , cmd : "db" | "dashboard" ) {
8484 const { theme } = args . parsedOptions
8585
8686 const { demo } = args . parsedOptions
8787 const scale = args . parsedOptions . s || 1
8888
89- const kind = args . argvNoOptions [ args . argvNoOptions . indexOf ( "dashboard" ) + 1 ] || "all"
90- const { jobId, profile } = await jobIdFrom ( args )
89+ const kind = args . argvNoOptions [ args . argvNoOptions . indexOf ( cmd ) + 1 ] || "all"
90+ const { jobId, profile } = await jobIdFrom ( args , cmd )
9191
9292 if ( ! isValidKindA ( kind ) ) {
93- throw new Error ( usage ( ) )
93+ throw new Error ( usage ( cmd ) )
9494 } else if ( ! jobId ) {
95- throw new Error ( usage ( ) )
95+ throw new Error ( usage ( cmd ) )
9696 }
9797
9898 const gridFor = async ( kind : "status" | "cpu" | "memory" ) : Promise < GridSpec > => {
@@ -118,7 +118,7 @@ export default async function dashboard(args: Arguments<Options>) {
118118 const db = dashboardUI ( profile , jobId , await gridForA ( kind ) , { scale } )
119119
120120 if ( ! db ) {
121- throw new Error ( usage ( ) )
121+ throw new Error ( usage ( cmd ) )
122122 } else {
123123 const { render } = await import ( "ink" )
124124
0 commit comments