8000 Allow `switch` with zero arguments · Issue #5677 · fish-shell/fish-shell · GitHub
[go: up one dir, main page]

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

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0