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

Intuitive syntax for calling external programs preserving output #649

Open
mturilin opened this issue Aug 3, 2023 · 6 comments
Open

Intuitive syntax for calling external programs preserving output #649

mturilin opened this issue Aug 3, 2023 · 6 comments

Comments

@mturilin
Copy link

mturilin commented Aug 3, 2023

Note: This is a minor nitpick for otherwise an amazing system.

Role:
As a developer, I want to use NGS to create scripts that stitch together external commands, like in shell scripts.

Problem:
$(top_level:: looks less intuitive than plan bash.

Example 1: NGS

{
  for container in containers {
    $(top_level::  ./launch_container.sh ${container})
  }
}

You can see that $(top_level:: visually distracts from the command itself.

Bash:

for i in {1..3}
do
  ./launch_container.sh ${containers[$i]}
done

I think this syntax looks much cleaner.

@mturilin
Copy link
Author

mturilin commented Aug 3, 2023

As discussed in the chat, a single $ option could be much nicer:

{
  for container in containers {
    $ ./launch_container.sh ${container}
  }
}

@ilyash-b
Copy link
Contributor

ilyash-b commented Aug 7, 2023

Having some reservations (it would already be implemented otherwise). Thinking here:

This is line oriented syntax: from $ and until end of line. Not particularly fond of it. Can't have multiple commands on the same line while you can have other syntax elements separated by ; on the same line. $ ...; ... would look weird.

$ ... is kind of counterpart of $(...). Since there is %(...) syntax (for defining a command without running it), one might expect % ... syntax as well, which I was not thinking implementing.

@ilyash-b ilyash-b pinned this issue Aug 29, 2023
@ilyash-b
Copy link
Contributor

Still thinking about syntax and not finding anything that would be "oh, that's right!".

Any ideas on that front @mturilin ?

@ilyash-b ilyash-b changed the title Create more intuitive syntax for calling external programs preserving output Intuitive syntax for calling external programs preserving output Aug 29, 2023
@mturilin
Copy link
Author

I was also looking at xonsh and they have nice syntax for "uncaptured subprocess": https://xon.sh/tutorial.html#uncaptured-subprocess-with-and

My previous example would look like this:

{
  for container in containers {
    $[./launch_container.sh ${container}]
  }
}

@ilyash-b
Copy link
Contributor

Sounds like a candidate. Need to think a bit about how it fits with the rest.

@ilyash-b
Copy link
Contributor

In dev branch now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants