Skip to content

fix public boolean switches in the standard library#10477

Merged
fdncred merged 1 commit intonushell:mainfrom
amtoine:fix-boolean-switches
Sep 23, 2023
Merged

fix public boolean switches in the standard library#10477
fdncred merged 1 commit intonushell:mainfrom
amtoine:fix-boolean-switches

Conversation

@amtoine
Copy link
Copy Markdown
Member

@amtoine amtoine commented Sep 23, 2023

related to

Description

this PR will fix the public API of the standard library by removing the type annotations from public boolean switches.

  1. the signature before
clip [--silent: bool, --no-notify: bool, --no-strip: bool, --expand (-e): bool, --codepage (-c): int]
  1. the signature after
clip [--silent, --no-notify, --no-strip, --expand (-e), --codepage (-c): int]

User-Facing Changes

before

> "foo" | clip
Error: nu::shell::cant_convert

  × Can't convert to bool.
     ╭─[NU_STDLIB_VIRTUAL_DIR/std/mod.nu:148:1]
 148 │         $in
 149 │         | if $expand { table --expand } else { table }
     ·              ───┬───
     ·                 ╰── can't convert nothing to bool
 150          | into string
     ╰────

after

> "foo" | clip
foo
saved to clipboard

Tests + Formatting

After Submitting

@amtoine amtoine added the A:std-library Defining and improving the standard library written in Nu label Sep 23, 2023
@fdncred fdncred merged commit b6d31e0 into nushell:main Sep 23, 2023
@fdncred
Copy link
Copy Markdown
Contributor

fdncred commented Sep 23, 2023

Thanks

@amtoine amtoine deleted the fix-boolean-switches branch September 24, 2023 08:20
hardfau1t pushed a commit to hardfau1t/nushell that referenced this pull request Dec 14, 2023
related to
- nushell#10456

# Description
this PR will fix the public API of the standard library by removing the
type annotations from public boolean switches.

1. the signature before
```nushell
clip [--silent: bool, --no-notify: bool, --no-strip: bool, --expand (-e): bool, --codepage (-c): int]
```
2. the signature after
```nushell
clip [--silent, --no-notify, --no-strip, --expand (-e), --codepage (-c): int]
```

# User-Facing Changes
### before
```nushell
> "foo" | clip
Error: nu::shell::cant_convert

  × Can't convert to bool.
     ╭─[NU_STDLIB_VIRTUAL_DIR/std/mod.nu:148:1]
 148 │         $in
 149 │         | if $expand { table --expand } else { table }
     ·              ───┬───
     ·                 ╰── can't convert nothing to bool
 150 │         | into string
     ╰────
```

### after
```nushell
> "foo" | clip
foo
saved to clipboard
```

# Tests + Formatting

# After Submitting
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A:std-library Defining and improving the standard library written in Nu

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants