Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
RasPhilCo committed Feb 25, 2021
1 parent ed9376f commit 27bd59d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ export class Config implements IConfig {
this.windows = this.platform === 'win32'
this.bin = this.pjson.oclif.bin || this.name
this.dirname = this.pjson.oclif.dirname || this.name
// oclif only supports colons or spaces as separators
if ([':', ' '].includes(this.pjson.oclif.topicSeparator!)) this.topicSeparator = this.pjson.oclif.topicSeparator!
// currently, only colons or spaces are valid separators
if (this.pjson.oclif.topicSeparator && [':', ' '].includes(this.pjson.oclif.topicSeparator)) this.topicSeparator = this.pjson.oclif.topicSeparator!
if (this.platform === 'win32') this.dirname = this.dirname.replace('/', '\\')
this.userAgent = `${this.name}/${this.version} ${this.platform}-${this.arch} node-${process.version}`
this.shell = this._shell()
Expand Down
1 change: 1 addition & 0 deletions src/help/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ function getHelpSubject(args: string[]): string | undefined {

export abstract class HelpBase {
constructor(config: Interfaces.Config, opts: Partial<Interfaces.HelpOptions> = {}) {
if (!config.topicSeparator) config.topicSeparator = ':' // back-support @oclif/config
this.config = config
this.opts = {maxWidth: stdtermwidth, ...opts}
}
Expand Down
1 change: 1 addition & 0 deletions src/help/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ function collateSpacedCmdIDFromArgs(argv: string[], config: IConfig): string[] {
}

export function standarizeIDFromArgv(argv: string[], config: IConfig): string[] {
if (argv.length === 0) return argv
if (config.topicSeparator === ' ') argv = collateSpacedCmdIDFromArgs(argv, config)
else if (config.topicSeparator !== ':') argv[0] = argv[0].replace(new RegExp(config.topicSeparator, 'g'), ':')
return argv
Expand Down

0 comments on commit 27bd59d

Please sign in to comment.