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

Hide recipe from the --list and --summary commands #228

Closed
cledoux opened this issue Oct 5, 2017 · 4 comments
Closed

Hide recipe from the --list and --summary commands #228

cledoux opened this issue Oct 5, 2017 · 4 comments

Comments

@cledoux
Copy link

cledoux commented Oct 5, 2017

Is it possible to mark certain recipes as private, such that just --list and just --summary does not display them?

I often use "helper" recipes that would simply clutter the output of list and summary.

@casey
Copy link
Owner

casey commented Oct 5, 2017

Not at the moment, but it sounds like a reasonable feature.

Can you share a justfile with examples? It would be great to see some examples. Feel free to remove the actual commands, rename a bit if there's sensitive stuff in there.

One way to do this might be to make recipes that start with an underscore "private" and not show up in --list and --summary. (_build-helper, _test-helper, etc).

Does that sound reasonable? Other ideas are definitely welcome.

@TeddyDD
Copy link

TeddyDD commented Oct 5, 2017

@casey I like your idea. Alternatively I propose to hide recipes that starts with dot .private:

@casey
Copy link
Owner

casey commented Oct 6, 2017

@TeddyDD: I think I find dots more aesthetically pleasing. However, dots are not currently allowed in names, and I have vague thoughts about using them in the future for things like property access, or maybe special kinds of recipes.

Underscores are a little less attractive, but they're already used for private names in python and javascript, so we would be taking advantage of an existing convention. We would be breaking existing justfiles that use names that start with an underscore, but I think they're probably rare, so it's not a serious breakage.

@cledoux Are the recipes that you make private ever called from outside, or only within the justfile?

@cledoux
Copy link
Author

cledoux commented Oct 6, 2017

@casey Here's the basic structure of a Justfile I was writing today that used helper recipes. An analysis system we've built has four steps to testing it: setup the environment, run the analysis on test data, verify the output, clean up the test environment.

test: test-clean
    just test-setup
    just test-analyze
    just test-verify
    just test-clean

test-clean:
    rm -rf test-directory

test-setup:
    mkdir -p test-directory
    # Some custom setup code

test-analyze:
    # Run system on test data

test-verify:
    # Verify that the output of the analysis was as expected.

I sometimes call the test-cleanup recipe manually, but other than that the recipes are only called from within the justfile. I could, if needed, define my test-cleanup as a public recipe and the other helpers as private.

In general, I think of my helper recipes as private functions in python. I don't intend for anyone to use them directly, but if you know what you are doing and really want to use them, I'm not going to try and stop you.

It's probably worth mentioning that the Justfiles I write are used by our entire dev team. Part of the reason I want to hide the helper recipes is because I want to make it clear that these recipes are not meant to be run directly. A naming convention is a decent enough workaround, but it does clutter the output of the help commands.

As per the naming convention, we are a python shop, so underscores make perfect sense for us. 😄

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

No branches or pull requests

3 participants