-
Notifications
You must be signed in to change notification settings - Fork 476
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
Recipe grouping #1842
Recipe grouping #1842
Conversation
I'm currently using the |
Nice! You might want to rebase, I just merged a PR which allows overriding the confirm prompt using I think |
I think probably the global flag should get |
Makes sense. This is a feature that I personally want and expect to use reasonably frequently, so I'd want to add a short flag. Maybe |
Do we want to keep the |
90a400c
to
5a7ba42
Compare
Oh, hmmm, I see. Then you wouldn't have to do
It made it into a release, so we should keep it. But I think the other reason for keeping it is that we might want to have attributes that take multiple arguments. So |
I like the idea of listing by groups by default. A justfile without any recipes with a |
630f186
to
77657a1
Compare
Alright, got this working like so: justfile:
This code deliberately allows you to put a recipe in as many groups as you want, and prints a recipe listing once per group it's in. I think these are good defaults, and if they're not what people want in all cases I think it'd be fine to add additional flags to |
#1344 is also probably taken care of by this PR |
@casey this is ready for review |
when merge? |
I'm super busy with another project, so just is sadly being neglected right now. Honestly it'll probably take at least a month before I can start grinding down my GitHub notification backlog, which is insanely large at this point. |
0e81744
to
becb2a8
Compare
In reading the docs that were added, I'm wondering if you would consider the following output. It's a little more readable to me and is based off of how Django does it.
Instead of:
|
Thank you for the update! I'm really looking forward to this new feature getting added! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did a little review, see comments.
src/attribute.rs
Outdated
Self::Group { name } => { | ||
let use_quotes = name.contains(char::is_whitespace); | ||
let mq = if use_quotes { "\"" } else { "" }; | ||
write!(f, "{attr_name}({mq}{name}{mq})") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will not work in general. Single quoted strings, and triple-delimited strings might have content that can't be contained in a single "
. I think the simplest thing is to punt on accepting bare words, and only accept string literals for the time being.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense. I modified Group
to take a StringLiteral
.
GRAMMAR.md
Outdated
@@ -111,6 +111,7 @@ recipe : attributes* '@'? NAME parameter* variadic? ':' dependency* body? | |||
attributes : '[' attribute* ']' eol | |||
|
|||
attribute : NAME ( '(' string ')' )? | |||
| NAME ':' string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer to leave this syntax for a follow up PR, to keep this one simple.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed the code that did this parsing from the PR
src/recipe.rs
Outdated
use std::collections::HashSet; | ||
use std::process::{ExitStatus, Stdio}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These imports can be combined.
I started looking at this, and to be honest I don't really like the refactor into multiple functions. I don't really mind long functions, and generally don't like functions which are defined and only used once. I think I prefer being able to read a long linear function, and not indirect through other functions. Also, it makes the review harder, because it's hard to tell what changed and what didn't. Can you inline it back into a single function in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Some notes:
- On entries of vecs, you can do
.or_default().push(x)
which saves some characters. - I had to indent the group names because of a conflict with the way modules are printed. Without indenting the group names, it isn't clear that the modules aren't part of the groups.
Implements recipe grouping feature, see #1776