Skip to content
This repository has been archived by the owner on Aug 22, 2023. It is now read-only.

feat: support src/command/index cmd #153

Merged
merged 5 commits into from
Aug 3, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import {Topic} from './topic'
import {tsPath} from './ts-node'
import {compact, exists, flatMap, loadJSON, mapValues} from './util'

const ROOT_INDEX_CMD_ID = ''

export interface Options {
root: string;
name?: string;
Expand Down Expand Up @@ -232,6 +234,8 @@ export class Plugin implements IPlugin {
const p = path.parse(file)
const topics = p.dir.split('/')
const command = p.name !== 'index' && p.name
// support src/commands/index as a "root" command
if (!command && this.type === 'core' && p.dir.length === 0 && p.name === 'index') return ROOT_INDEX_CMD_ID
return [...topics, command].filter(f => f).join(':')
})
this._debug('found commands', ids)
Expand Down