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

Add prompt string interpolation #311

Merged
merged 10 commits into from
Nov 13, 2024
Merged

Conversation

pederhan
Copy link
Member

Adds string interpolation support for the CLI prompt. In order to test this, the get_prompt_message() function has been extracted from main().

Furthermore, the parsing of command-line config arguments is now moved into the config itself. CLI args are now accessed through MregCliConfig.get() instead of via vars(args).

@pederhan pederhan requested a review from terjekv October 21, 2024 11:13
Copy link
Collaborator

@terjekv terjekv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Collaborator

@terjekv terjekv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

README.md Outdated

#### Disabling the prompt text

The prompt text can be disabled by setting it to an empty string in either the config or as a command line argument:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does "disabled" mean in this context? ">" or ""?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It means >, which is why I specified "prompt text". If you have any ideas how to make it clearer, then I'll change it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was changed to "prompt prefix text", which isn't great, but it should remove any ambiguity when combined with the example showing the result.

mreg_cli/main.py Outdated Show resolved Hide resolved
@pederhan
Copy link
Member Author

I think this is ready now? There are some basic unit test for IPv4 and IPv6, but they are not comprehensive at all. Should be fine though.

@pederhan
Copy link
Member Author

pederhan commented Nov 12, 2024

One last thing we should consider taking a look at is moving the prompt configuration section in the README somewhere else, because it takes up a lot of space very early on for such a trivial feature.

Edit: I hid it in a collapsible section that defaults to being closed.

README.md Show resolved Hide resolved
@terjekv terjekv self-requested a review November 13, 2024 07:53
Copy link
Collaborator

@terjekv terjekv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@terjekv terjekv merged commit 6a11185 into unioslo:master Nov 13, 2024
6 checks passed
@pederhan pederhan deleted the configurable-prompt branch November 13, 2024 08:17
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.

2 participants