Skip to content

Allow switch with zero arguments #5677

@floam

Description

@floam

I think one should be able to switch on a variable that may or may not be set:

switch $LANG
    case 'en_US*'
...
end

If $LANG is unset:

fish: switch: Expected exactly one argument, got 0

(Same with command substitutions which may sometimes print nothing.)

I think it should just silently short circuit and do nothing.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions