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

prefix all messages (event error messages) with check on quiet #140

Merged
merged 4 commits into from
Oct 25, 2024

Conversation

tomeichlersmith
Copy link
Owner

This resolves #139 by silencing all1 messages when the user requests --quiet. I think there are some updates to the init recipe in the ldmx-sw justfile that are important as well, but this at least avoids the confusing error message being printed when a normal situation occurs.

Namely

if ! denv check --workspace --quiet; then
  denv init owner/repo:tag
fi

can quietly insure that a workspace has been initialized in scripts.

Leaving this as draft while I think about if there is a better solution. Maybe a flag to denv init can encompass the above code in scripts in a more clear manner. 🤔

Footnotes

  1. Except the CL parsing error message which doesn't know if the user wants --quiet or not yet.

@tomeichlersmith
Copy link
Owner Author

Just brainstorming.

There are two decisions a user has to make when running denv init. Whether to overwrite/override an existing denv and whether to create WORKSPACE if it doesn't exist yet. We could have these decision made on the CL so that script-writers could avoid prompts and we could have these separate so that script writers could silently avoid re-initializing by simply passing a CL flag.
This complicates the denv init CL but keeps denv check something that users would do as a debugging measure.

I think a full CL implementation would involve four new flags.

--[no-]over  : Don't ask about overwrite/override. Instead just do it (--over) or don't do it (--no-over).
--[no-]mkdir : Don't ask about creating WORKSPACE if it doesn't exist. Instead just do it (--mkdir) or don't (--no-mkdir).

And --force would become an alias for --over --mkdir.

tomeichlersmith added a commit that referenced this pull request Oct 25, 2024
This introduces four new command line flags to the `denv init` CLI
making it easier for script writers to avoid the user prompt if desired.
This follows the idea outlined in
#140 (comment)

`--[no-]mkdir` answers the prompt about if denv is allowed to create the workspace
directory if it doesn't exist.
`--[no-]over` answers the prompt about if denv is allowed to overwrite/override an
existing configuration

Besides the introduction of these flags, more tests were included to make sure
they are oprational. The manual and CLI help was updated accordingly,
and some cleanup was done to use true/false instead of 1/0 within variables
storing the results of these flags.
@tomeichlersmith tomeichlersmith force-pushed the 139-silent-denv-check-errors-on-quiet branch from e3cecb4 to 747de34 Compare October 25, 2024 19:12
@tomeichlersmith tomeichlersmith marked this pull request as ready for review October 25, 2024 19:34
@tomeichlersmith tomeichlersmith merged commit e17752e into main Oct 25, 2024
10 checks passed
@tomeichlersmith tomeichlersmith deleted the 139-silent-denv-check-errors-on-quiet branch October 25, 2024 19:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Init doesnt work in ldmx-sw docker version
1 participant