Skip to content

# parsing inhibits use of some commands #6335

Closed

Description

@Lord-Valen

Describe the bug

This is a blocker for nix users. # is used to indicate comments in nushell but some commands use it.
For example with nix-commands you might want to:

nix run nixpkgs#cowsay "I'm a cow!"

Or:

nix profile install nixpkgs#cowsay

But nushell renders this useless as everything after # is a comment.

How to reproduce

  1. Be using nushell
  2. Have nix installed
  3. Have nix-commands enabled
  4. nix run nixpkgs#<somePackage>

Expected behavior

I expected nu to interpret # as part of the command if there is not whitespace in front.

Screenshots

image

Configuration

key value
version 0.65.0
branch
commit_hash
build_os linux-x86_64
build_target x86_64-unknown-linux-gnu
rust_version rustc 1.62.1
cargo_version cargo 1.62.0
pkg_version 0.65.0
build_time 1980-01-01 00:00:00 +00:00
build_rust_channel release
features database, dataframe, default, trash, which, zip
installed_plugins

Additional context

No response

Activity

  1. added
    A:parser
    on Aug 15, 2022
  2. jmoore34 commented on Aug 15, 2022

    @jmoore34
    Contributor

    Does nix run 'nixpkgs#cowsay' "I'm a cow" or nix profile install 'nixpkgs#cowsay' work?

  3. kubouch commented on Aug 15, 2022

    @kubouch
    Contributor

    You should be able to call external commands with # like this:

    ^`foo#bar`
    

    but this shouldn't be necessary. What @jmoore34 suggested should work.

    As a side note, you can create a custom command with #

    def `foo#bar` [] { }
    

    but this shouldn't be possible, we need to fix the parser to not allow it when checking the command name.

  4. Lord-Valen commented on Aug 15, 2022

    @Lord-Valen
    Author

    Does nix run 'nixpkgs#cowsay' "I'm a cow" or nix profile install 'nixpkgs#cowsay' work?

    Ah yes, it does. Thanks! But there's still a question of whether the default behaviour should change anyway.

  5. sholderbach commented on Feb 22, 2023

    @sholderbach
    Member

    Resolved by #8151

  6. added this to the v0.77.0 milestone on Feb 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A:parser

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions