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

u_milestones will now autogenerate relevant keys from the schema #970

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 15 additions & 28 deletions regolith/helpers/u_milestonehelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from regolith.tools import all_docs_from_collection, fragment_retrieval
from regolith.dates import get_due_date
from regolith.schemas import PROJECTUM_ACTIVE_STATI, \
MILESTONE_TYPES, PROJECTUM_STATI
MILESTONE_TYPES, PROJECTUM_STATI, SCHEMAS


TARGET_COLL = "projecta"
Expand Down Expand Up @@ -43,33 +43,20 @@ def subparser(subpi):
type=str)
subpi.add_argument("-v", "--verbose", action="store_true",
help="Increases the verbosity of the output.")
subpi.add_argument("-u", "--due-date",
help="New due date of the milestone. "
"Required for a new milestone.",
**date_kwargs)
subpi.add_argument("-n", "--name",
help="Name of the milestone. "
"Required for a new milestone.")
subpi.add_argument("-o", "--objective",
help="Objective of the milestone. "
"Required for a new milestone.")
subpi.add_argument("-s", "--status",
help="Status of the milestone/deliverable: "
f"{*PROJECTUM_STATI,}. "
"Defaults to proposed for a new milestone.")
subpi.add_argument("-t", "--type",
help="Type of the milestone: "
f"{*MILESTONE_TYPES,} "
"Defaults to meeting for a new milestone.")
subpi.add_argument("-a", "--audience",
nargs='+',
help="Audience of the milestone. "
"Defaults to ['lead', 'pi', 'group_members'] for a new milestone.",
)
subpi.add_argument("--notes",
nargs='+',
help="Any notes you want to add to the milestone."
)

milestone_keys = [key for key in
SCHEMAS.get('projecta').get('milestones').get(
'schema').get('schema')]
milestone_helps = milestone_keys
milestone_helps = [help[1].get('description') for help in
SCHEMAS.get('projecta').get('milestones').get(
'schema').get('schema').items()]

for key, help in zip(milestone_keys, milestone_helps):
subpi.add_argument(f"--{key}",
help=f"{help}"
)

subpi.add_argument("-f", "--finish", action="store_true",
help="Finish milestone. "
)
Expand Down