Page MenuHomePhabricator

Allow passing arguments into container
Closed, ResolvedPublic

Description

It would be nice to be able to run fresh {whatever args I want} and have those arguments run as a command in the container.

  • Sometimes I end up with lengthy commands in my history like ./node_modules/.bin/stylelint --fix modules/homepage/ext.growthExperiments.StartModule.less and on my host terminal, where I have access to tools like fzf, it's trivial to recall them. But in fresh cmd+R is not quite as nice, if functional enough.
  • For text editors / IDEs, you could configure those to run fresh npm run test from some keystroke in your editor, or automatically via e.g. a pre-commit hook

Imported from https://github.com/wikimedia/fresh/issues/22.

Event Timeline

Sounds good to me.

A few quick notes:

  • I added something like this unofficially for the test suite ("FRESH_INTERNAL_RUNCMD"). So I suggest we replace that with what we come up with here.
  • Note that grunt or stylelint would not be available here. I think it would be good practice to maintain those commands in package.json instead and invoke npm run … instead. That keeps the code central, avoids hardcoding for node_modules in Fresh, and makes it easier for users to run those same things by other means if they don't want or can't use pre-commit hooks.
  • Slight nitpick - "Entrypoint" might be too easily confused with the docker internals. Perhaps even simpler would be to consider all arguments after -- as the command to execute?

For example

fresh -- npm run lint
fresh -- npm run fix:less
Krinkle triaged this task as Medium priority.Aug 8 2020, 3:00 PM
Krinkle moved this task from Inbox to Enhancement on the Fresh board.

Change 710413 had a related patch set uploaded (by Krinkle; author: Gergő Tisza):

[fresh@master] fresh-node: Mention FRESH_INTERNAL_RUNCMD in usage documentation

https://gerrit.wikimedia.org/r/710413

Change 710413 merged by jenkins-bot:

[fresh@master] fresh-node: Mention FRESH_INTERNAL_RUNCMD in usage documentation

https://gerrit.wikimedia.org/r/710413

Change 912792 had a related patch set uploaded (by Gergő Tisza; author: Gergő Tisza):

[fresh@master] Take command to execute as a positional argument

https://gerrit.wikimedia.org/r/912792

Change 912792 merged by jenkins-bot:

[fresh@master] Take command to execute as a positional argument

https://gerrit.wikimedia.org/r/912792

Krinkle reassigned this task from BAbiola-WMF to Tgr.
Krinkle added a subscriber: BAbiola-WMF.

Change 915943 had a related patch set uploaded (by Krinkle; author: Krinkle):

[fresh@master] Replace welcome message with a shorter version

https://gerrit.wikimedia.org/r/915943

Change 915943 merged by jenkins-bot:

[fresh@master] Replace welcome message with a shorter version

https://gerrit.wikimedia.org/r/915943