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

Expose some commands to external world #6554

Closed
hugosenari opened this issue Sep 13, 2022 · 6 comments
Closed

Expose some commands to external world #6554

hugosenari opened this issue Sep 13, 2022 · 6 comments
Labels
enhancement New feature or request post-1.0 This cool feature may be in the further future but doesn't have to land before 1.0

Comments

@hugosenari
Copy link

Related problem

Nushell actually could replace some other tools like: jo, jq, jy, wget, table ...

Even if people don't download it because of shell or script, they could install as bundle of tools,

But call nu -c 'i need to learn nu' isn't nice.

No I'm not asking to expose all commands, only those super cool

Describe the solution you'd like

Provide some scripts to help user integrate it with their current shell/workflow without requiring to learn nu.

IE:

#/usr/bin/nu --stdin
# convert formats --inputFormat|-i format --outputFormat|-o format
def main [
   --inputFormat (-i): string = nuon,
   --outputFormat (-o): string = json] {
    $in |  if $inputFormat in [json]     {
        from json
    } else if $inputFormat in [nu nuon]  {
        from nuon
    } else if $inputFormat in [tml toml] {
        from toml
    } else if $inputFormat in [yml yaml] {
        from yaml
    }|     if $outputFormat in [json]     {
        to json
    } else if $outputFormat in [nuon nu]  {
        to nuon
    } else if $outputFormat in [toml tml] {
        to toml
    } else if $outputFormat in [yaml yml] {
        to yaml
    }
}

Now user can call

curl "http://bla.bla" | nuon -o  toml

Instead of

curl "http://bla.bla" | nu --stdin -c '$in | from json | to toml'

Describe alternatives you've considered

There are alternatives to that, but all them comes in different packages and installation process.

Additional context and details

What commands expose and how expose is up to you, the one above is just a suggestion.

I know that nu_scripts have some cool ones, I liked ymd and dmy

@hugosenari hugosenari added the enhancement New feature or request label Sep 13, 2022
@github-actions github-actions bot added the Stale used for marking issues and prs as stale label Jan 19, 2023
@hugosenari
Copy link
Author

@amtoine
Copy link
Member

amtoine commented Jul 8, 2023

this is kinda cool 😮

i'm not sure what the request here really is @hugosenari 🤔
this is just a script that people could download and use without dropping in the Nushell REPL, do you mean it could be somehow bundled with the nu binary?

@hugosenari
Copy link
Author

use without dropping in the Nushell REPL

Neither the Nushell Script, ;-)
Nothing against it, I love it, but being honest, make people migrate from Sh/Bash/Ksh REPL/Script to Nushell isn't easy, maybe we could make them install Nushelll as 'tool' first to use in their current REPL/script, them as script, and finally as REPL.

it could be somehow bundled with the nu binary

👿 "Overnight, Netscape's, primary product had been reduced to a feature of another, more popular product."¹

One more or less similar example of this in the wild is python -m http.server
While that explores other feature (run installed packages) and could have better discoverability (UX), we don't need install nothing other than python to use it and is much more simple than 'python -c "import http.server as s; s()"

¹ https://www.neversaw.us/2023/06/30/understanding-wasm/part2/whence-wasm/

@amtoine
Copy link
Member

amtoine commented Jul 11, 2023

we have started writing a package manager for Nushell, i guess this could be part of an official package and installed that way.
or it could be part of the standard library and you'd simply have to use ... and then call the command 👍

@sholderbach sholderbach added post-1.0 This cool feature may be in the further future but doesn't have to land before 1.0 and removed Stale used for marking issues and prs as stale labels Aug 9, 2023
@sholderbach
Copy link
Member

We want to focus on getting the experience inside nushell right and probably won't be able to dedicate design time to get the interface of native Nu commands with an outside POSIX shell right and stable.

@hugosenari
Copy link
Author

Closing it for now 😉

@hugosenari hugosenari closed this as not planned Won't fix, can't repro, duplicate, stale Aug 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request post-1.0 This cool feature may be in the further future but doesn't have to land before 1.0
Projects
None yet
Development

No branches or pull requests

3 participants