Skip to content

Commit

Permalink
chore: nullish coalescing
Browse files Browse the repository at this point in the history
  • Loading branch information
iowillhoit committed Oct 24, 2023
1 parent b020930 commit 19c2d6c
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/autocomplete/powershell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ ${flaghHashtables.join('\n')}
for (const p of this.config.getPluginsList()) {
for (const c of p.commands) {
if (c.hidden) continue
const summary = this.sanitizeSummary(c.summary || c.description)
const summary = this.sanitizeSummary(c.summary ?? c.description)
const {flags} = c
cmds.push({
flags,
Expand Down
4 changes: 2 additions & 2 deletions src/autocomplete/zsh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ _${this.config.bin}
// skip hidden flags
if (f.hidden) continue

const flagSummary = this.sanitizeSummary(f.summary || f.description)
const flagSummary = this.sanitizeSummary(f.summary ?? f.description)

let flagSpec = ''

Expand Down Expand Up @@ -338,7 +338,7 @@ _${this.config.bin}
for (const p of this.config.getPluginsList()) {
for (const c of p.commands) {
if (c.hidden) continue
const summary = this.sanitizeSummary(c.summary || c.description)
const summary = this.sanitizeSummary(c.summary ?? c.description)
const {flags} = c
cmds.push({
flags,
Expand Down
2 changes: 1 addition & 1 deletion src/commands/autocomplete/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export default class Create extends AutocompleteBase {
for (const c of p.commands) {
try {
if (c.hidden) continue
const description = sanitizeDescription(c.summary || c.description || '')
const description = sanitizeDescription(c.summary ?? (c.description || ''))
const {flags} = c
cmds.push({
description,
Expand Down
2 changes: 1 addition & 1 deletion src/commands/autocomplete/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export default class Index extends AutocompleteBase {

async run() {
const {args, flags} = await this.parse(Index)
const shell = args.shell || this.determineShell(this.config.shell)
const shell = args.shell ?? this.determineShell(this.config.shell)

if (shell === 'powershell' && this.config?.topicSeparator === ':') {
this.error(
Expand Down
2 changes: 1 addition & 1 deletion src/commands/autocomplete/script.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default class Script extends AutocompleteBase {

async run() {
const {args} = await this.parse(Script)
const shell = args.shell || this.config.shell
const shell = args.shell ?? this.config.shell

const binUpcase = this.cliBinEnvVar
const shellUpcase = shell.toUpperCase()
Expand Down

0 comments on commit 19c2d6c

Please sign in to comment.