-
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
doc
attribute for docstrings
#2050
Conversation
I think this needs to be rebased on master, there are a bunch of extra commits in here. |
The new code in this PR is on top of #1842 since that changes how attribute parsing works. I'm not sure if there's a way to tell github to omit commits from another PR in the pull request UI. In any case, eda55cc has the code that is actually new in this PR; I'm fine with not trying to get this merged until 1842 is merged. |
src/recipe.rs
Outdated
pub(crate) fn docstring(&self) -> Option<&str> { | ||
for attribute in &self.attributes { | ||
if let Attribute::Doc { docstring } = attribute { | ||
return docstring.as_ref().map(|s| s.as_str()); |
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.
.map(|s| s.as_str()) => .map(String::as_str())
I'm going to cut a release tomorrow, which will be a monster one, since the features have piled up. I think this would be sweet, if you want to get it in. No worries if you don't have time though! |
Yeah, it'd be great to get this in this release, although what I really care about is recipe groups so if this has to wait, not the end of the world. |
Dope! |
@neunenak Thanks for working on this, I'm looking forward to using this one. _default:
@just --list
[doc('this is a long line
which gives usage instruction for
test recipe')]
test:
echo "testing" When I run $ just
Available recipes:
test # this is a long line
which gives usage instruction for
test recipe It would be great (in terms of readability) if can indent the extra lines as per indentation of the first line. $ just
Available recipes:
test # this is a long line
which gives usage instruction for
test recipe Is there a way I can do this now? |
Is this really needed, when you can also just leave a blank line between comment and recipe ? |
cf. #1955 , it would be convenient if there was a way to specify a recipe documentation string with an attribute. Also this would make possible to provide a docstring that is different from actual comments in the justfile.