Skip to content

feat(math): add math cbrt builtin - #18481

Merged
fdncred merged 3 commits into
nushell:mainfrom
pheenty:feat/cbrt
Jun 27, 2026
Merged

fdncred merged 3 commits into
nushell:mainfrom
pheenty:feat/cbrt

Conversation

@pheenty

@pheenty pheenty commented Jun 27, 2026 •

Copy link
Copy Markdown
Contributor

Description

literally the title.

User-facing changes (Release notes)

Added math cbrt (cube root) function.

@fdncred

fdncred commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

There should be some search terms in this command like cube and root since those aren't part of the command name

@pheenty

pheenty commented Jun 27, 2026

Copy link
Copy Markdown
Contributor Author

There should be some search terms in this command like cube and root since those aren't part of the command name

Just found that trying "root" command only suggests is-admin, despite "root" being in sqrt search_terms

@pheenty

pheenty commented Jun 27, 2026

Copy link
Copy Markdown
Contributor Author

unrelated to the pr, but regarding this

    #[test]
    fn no_search_term_duplicates() {
        let ctx = add_command_context(EngineState::new());
        let decls = ctx.get_decls_sorted(true);
        let mut failures = Vec::new();

        for (name_bytes, decl_id) in decls {
            let cmd = ctx.get_decl(decl_id);
            let cmd_name = String::from_utf8_lossy(&name_bytes);
            let search_terms = cmd.search_terms();
            let category = cmd.signature().category;

            for search_term in search_terms {
                if cmd_name.contains(search_term) {
                    failures.push(format!("{cmd_name} ({category:?}): Search term \"{search_term}\" is substring of command name \"{cmd_name}\""));
                }
            }
        }

        assert!(
            failures.is_empty(),
            "Duplication in search terms:\n{}",
            failures.join("\n")
        );
    }

the test is likely doing not what it's supposed to do
if i understand correctly, despite being called "no_search_term_duplicates", it merely checks whether command search terms are not part of the command itself

Duplication in search terms:
math cbrt (Math): Search term "cbrt" is substring of command name "math cbrt"

@pheenty

pheenty commented Jun 27, 2026 •

Copy link
Copy Markdown
Contributor Author

I've opened another PR for this. This one will fail tests until that one is merged anyway

@fdncred

fdncred commented Jun 27, 2026 •

Copy link
Copy Markdown
Contributor

Just found that trying "root" command only suggests is-admin, despite "root" being in sqrt search_terms

The search terms are meant to be used by help --find term not in the did-you-mean help.

it merely checks whether command search terms are not part of the command itself

Ya, that's what it's supposed to do but it should check for duplicates in the list of search terms too.

@pheenty

pheenty commented Jun 27, 2026

Copy link
Copy Markdown
Contributor Author

Okay, I'll remove cbrt from search terms then

@fdncred
fdncred merged commit 7b4aa4d into nushell:main Jun 27, 2026
17 checks passed
@fdncred

fdncred commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Thanks

@github-actions github-actions Bot added this to the v0.114.0 milestone Jun 27, 2026
@fdncred fdncred added notes:ready Indicates Ready for Release notes notes:additions Noted in "Additions" section labels Jun 27, 2026
@pheenty
pheenty deleted the feat/cbrt branch June 27, 2026 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

notes:additions Noted in "Additions" section notes:ready Indicates Ready for Release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants