-
-
Notifications
You must be signed in to change notification settings - Fork 15
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
feat(cli): add create piece functionality #300
feat(cli): add create piece functionality #300
Conversation
This looks like a great feature, well done @tdari 🚀 |
e46d6aa
to
a4fc825
Compare
def _validate_piece_name(name: str): | ||
if len(name) == 0: | ||
raise ValidationError(f"Piece name must have at least one character.") | ||
regex = r'^[A-Za-z_][A-Za-z0-9_]*$' |
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.
Maybe I'm wrong @vinicvaz but I think the piece name should end with "Piece" right ?
Like: "FooBarPiece"
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.
Hey @tdari this is really good and useful, thanks for submitting.
What you think about removing the pieces cli from the piece-repository nesting? I think we don't need this dependency since the CLI will execute on the current folder.
This usage looks simpler to me:
domino pieces --create <name>
What you think about that?
src/domino/cli/cli.py
Outdated
def cli_pieces(ctx): | ||
console.print("Manage piece folders.") |
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.
We can add a docstring to be shown in the CLI interface.
Something like:
def cli_pieces(ctx): | |
console.print("Manage piece folders.") | |
def cli_pieces(ctx): | |
"""Manage pieces in a repository.""" | |
console.print("Manage piece folders.") |
I also think the current version is a little bit made it longer, your suggestion can work but I think the cli shouldn't be dependent on the directory it has been called (even though its dependent right now). We can add a repository option to specify which repository this new piece will be added to, like, |
@tdari I agree with that accepting repository path to the pieces creation is the best.
Are you planning to add the path argument in this PR? Also, feel free to send a PR including this in the docs here https://github.com/Tauffer-Consulting/domino-docs |
@vinicvaz yes I'll re-open this again including all the revisions. Thank you. |
a4fc825
to
00f57bf
Compare
9d593da
to
fed4636
Compare
@tdari great you are adding tests! |
@vinicvaz it looks good to me. what about making it even shorter by using just repository instead of piece-repository. |
I aggree users probably will understand but as we are using Pieces Repository in almost everywhere (docs, code, etc) I think it will be better to keep pieces-repository . Basically applying the explicit better than implicit rule for this |
nice work here @tdari ! |
fed4636
to
520bd94
Compare
520bd94
to
75df892
Compare
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.
Nice work @tdari thanks for submitting this!
Thanks, @vinicvaz. I checked the docs as you suggested, but I didn't want to add the new feature to the docs since there was only a paragraph mentioning the CLI. We can add it later once the CLI becomes mature enough, or we can write a post in the blog section to show users how they can create their pieces and mention these features there. |
This PR will add create piece functionality to domino-cli. Users will be able to create boilerplate code necessary for the new pieces using this command:
domino piece-repository pieces create --name <name>