File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 11import jiti from 'jiti'
2- import { dirname } from 'pathe'
2+ import { resolve } from 'pathe'
33import { filename } from 'pathe/utils'
44import type {
55 ButtonConfig ,
@@ -62,9 +62,14 @@ export const resolveCommand = (
6262 } )
6363 const _cmdPath = _jiti . resolve ( cmd )
6464 const command = _jiti ( _cmdPath ) as HarmonixCommand
65+ const relativePath = resolve ( _cmdPath ) . replace ( harmonixOptions . rootDir , '' )
66+ const categoryMatch = relativePath . match (
67+ / \/ c o m m a n d s \/ ( .+ ?) \/ [ ^ \/ ] + \. ( t s | j s ) /
68+ )
69+ const category = categoryMatch ? categoryMatch [ 1 ] : undefined
6570 const config : CommandConfig = {
6671 name : command . config . name || filename ( _cmdPath ) ,
67- category : command . config . category || filename ( dirname ( _cmdPath ) ) ,
72+ category : command . config . category ?? category ,
6873 ...command . config
6974 }
7075
You can’t perform that action at this time.
0 commit comments