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

help command: Remove --find flag in favour of find command #7438

Open
vwkd opened this issue Dec 11, 2022 · 6 comments
Open

help command: Remove --find flag in favour of find command #7438

vwkd opened this issue Dec 11, 2022 · 6 comments

Comments

@vwkd
Copy link

vwkd commented Dec 11, 2022

Describe the bug

I'm confused when I should use the find flag instead of piping the output into the find command.

The find flag is present on the help command, I'm not sure if it's present anywhere else too.

IIUC, the find command can do everything the --find flag can, and more. One difference in the help commands --find flag seems that it doesn't search the signatures column. With the find command one can pipe through reject signatures before. In addition, the find command can filter by regex, and works everywhere else already.

Currently, these are two ways of doing the same one thing. This creates more complexity for the implementation and subsequent maintenance, as well as creating more confusion and obstacles for the learning user.

It seems commands are preferable over flags where appropriate because a command is usable for every command in the pipe and doesn't need a separate implementation.

Maybe I’m misremembering buy I believe to recall @jntrnr talking about preferring commands over flags somewhere though I can't find the source right now.

The premise of nushell seemed to be not having to remember different flags for every command anymore which change a command's behavior but to use a more structured pipe instead. It seems this fundamental principle is violated here.

How to reproduce

  1. help commands --find select
  2. help commands | find select

Expected behavior

A single one preferred way of doing things instead of multiple.

Screenshots

No response

Configuration

key value
version 0.72.1
branch
commit_hash
build_os macos-x86_64
build_target x86_64-apple-darwin
rust_version rustc 1.65.0
cargo_version cargo 1.65.0 (4bc8f24d3 2022-10-20)
pkg_version 0.72.1
build_time 2022-12-05 17:17:06 +00:00
build_rust_channel release
features database, default, trash, which, zip
installed_plugins

Additional context

No response

@fdncred
Copy link
Collaborator

fdncred commented Dec 11, 2022

help -f <search term> is a easier to type than help commands | find <search term> which is why it exists.

@vwkd
Copy link
Author

vwkd commented Dec 11, 2022

What is the reason to not use aliases for faster typing?

Aliases seem to be a more general solution for faster typing without the cost of adding a flag on every command.

I’m case nushell doesn’t support aliases for flags or even a chain of commands in a pipe, this could be added.

@rgwood
Copy link
Contributor

rgwood commented Dec 11, 2022

But then even the whole premise of nushell was to not have to remember different flags anymore that change a command's behavior but to use a more structured pipe instead

I would say that we prefer composition using pipes over flags but it's not an absolute rule. We're willing to use redundant flags if they make common use cases easier.

I find help -f useful (very quick to type) and I slightly lean toward keeping it even though it's redundant.

@sholderbach
Copy link
Member

help -f <search term> is a easier to type than help commands | find <search term> which is why it exists.

It actually does something slightly different than basic help commands | find ... as it narrows the search to name, usage and search_terms. It thus slightly increases signal to noise.

@vwkd
Copy link
Author

vwkd commented Dec 12, 2022

@sholderbach

One difference in the help commands --find flag seems that it doesn't search the signatures column. With the find command one can pipe through reject signatures before.

What’s the reason to not use the available pipe filtering commands like select or reject to increase signal to noise which also work in the general case?

@sholderbach
Copy link
Member

(I am gonna skip jury duty on this question of dogmatic consistency vs. convenience/muscle memory as I personally mostly use F1 for my command searching needs.)

@sholderbach sholderbach changed the title Remove --find flag in favour of find command help command: Remove --find flag in favour of find command Dec 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants