Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rm #15

Closed
wycats opened this issue May 19, 2019 · 1 comment
Closed

rm #15

wycats opened this issue May 19, 2019 · 1 comment
Projects

Comments

@wycats
Copy link
Contributor

wycats commented May 19, 2019

Basic spec:

function rm($file)
OR
function rm($it)

$file may be an absolute or relative path or a file object. $it may only be a file object.

If $file is a relative path, it's interpreted relative to the current cwd.

If the file to delete is a directory, it behaves like rm -rf in Linux or rm -Recurse -Force in PowerShell. The user must have permissions to delete the relevant files.

If the file to delete is a file, it behaves like rm. The user must have permissions to delete the relevant file.

Open Question: Should rm on a directory confirm? If so, how does it relate to #16.

@wycats wycats created this issue from a note in Tasks (Commands) May 19, 2019
@sophiajt
Copy link
Contributor

rm is now available

Tasks automation moved this from Commands to Done Jul 19, 2019
elferherrera pushed a commit to elferherrera/nushell that referenced this issue Feb 7, 2022
elferherrera pushed a commit to elferherrera/nushell that referenced this issue Feb 7, 2022
kubouch pushed a commit that referenced this issue Feb 7, 2022
sophiajt pushed a commit that referenced this issue Mar 22, 2023
This is a follow-up to #8379 and
#8502.

This PR makes it so that the new `?` syntax for marking a path member as
optional short-circuits, as voted on in the
[8502](#8502) poll.
Previously, `{ foo: 123 }.bar?.baz` would raise an error:

```
> { foo: 123 }.bar?.baz
  × Data cannot be accessed with a cell path
   ╭─[entry #15:1:1]
 1 │ { foo: 123 }.bar?.baz
   ·                   ─┬─
   ·                    ╰── nothing doesn't support cell paths
   ╰────
   ```

Here's what was happening:

1. The `bar?` path member access returns `nothing` because there is no field named `bar` on the record
2. The `baz` path member access fails when trying to access a `baz` field on that `nothing` value

After this change, `{ foo: 123 }.bar?.baz` returns `nothing`; the failed `bar?` access immediately returns `nothing` and the `baz` access never runs.
WindSoilder added a commit that referenced this issue Jan 25, 2024
# Description
This is a follow up to: #11365

After this pr, `--flag: bool` is no longer allowed.

I think `ParseWarning::Deprecated` is useful when we want to deprecated
something at syntax level, so I just leave it there for now.

# User-Facing Changes
## Before
```
❯ def foo [--b: bool] {}
Error:   × Deprecated: --flag: bool
   ╭─[entry #15:1:1]
 1 │ def foo [--b: bool] {}
   ·               ──┬─
   ·                 ╰── `--flag: bool` is deprecated and will be removed in 0.90. Please use `--flag` instead, more info: https://www.nushell.sh/book/custom_commands.html
   ╰────
```

## After
```
❯ def foo [--b: bool] {}
Error:   × Type annotations are not allowed for boolean switches.
   ╭─[entry #2:1:1]
 1 │ def foo [--b: bool] {}
   ·               ──┬─
   ·                 ╰── Remove the `: bool` type annotation.
   ╰────
```
# Tests + Formatting
Done
dmatos2012 pushed a commit to dmatos2012/nushell that referenced this issue Feb 20, 2024
# Description
This is a follow up to: nushell#11365

After this pr, `--flag: bool` is no longer allowed.

I think `ParseWarning::Deprecated` is useful when we want to deprecated
something at syntax level, so I just leave it there for now.

# User-Facing Changes
## Before
```
❯ def foo [--b: bool] {}
Error:   × Deprecated: --flag: bool
   ╭─[entry nushell#15:1:1]
 1 │ def foo [--b: bool] {}
   ·               ──┬─
   ·                 ╰── `--flag: bool` is deprecated and will be removed in 0.90. Please use `--flag` instead, more info: https://www.nushell.sh/book/custom_commands.html
   ╰────
```

## After
```
❯ def foo [--b: bool] {}
Error:   × Type annotations are not allowed for boolean switches.
   ╭─[entry nushell#2:1:1]
 1 │ def foo [--b: bool] {}
   ·               ──┬─
   ·                 ╰── Remove the `: bool` type annotation.
   ╰────
```
# Tests + Formatting
Done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Tasks
  
Done
Development

No branches or pull requests

2 participants