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

Prompt the user for a value for the category, if none was given #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Prompt the user for a value for the category, if none was given #7

wants to merge 1 commit into from

Conversation

mimischi
Copy link

We can now do a) dtr update --category CATEGORY1:VALUE1 CATEGORY2:VALUE2 and b) dtr update --category CATEGORY1 CATEGORY2. In the first case, the values for both keys CATEGORY1 and CATEGORY2 are updated immediately. In the second case, the user is prompted for values first.

Resolves #6.

@richardjgowers
Copy link

I don't like the prompt if missing, I'd rather this threw an error (but I'll let @dotsdl @kain88-de weigh in too)

@mimischi
Copy link
Author

mimischi commented Oct 11, 2018

My motivation for this is that there is a huge barrier to entry into using datreant in older projects. Most of my projects don't use datreant and I would like to migrate them, but I don't want to go ahead and write specialized scripts for each and everyone, just to set up the Treant. Furthermore, I don't know if I already thought about all categories that might be relevant for certain projects.

This functionality would make it easy to go and add a bunch of new categories to already existing bundles, while being dynamically prompted for the value.

Are you against such a feature in general or do you just dislike the "prompt if missing" stuff? If its the latter, we could also think about doing this with some other option.

@richardjgowers
Copy link

I guess I think of a cli as also being useful for scripting. The user prompts would cause a script to hang if you got a k:v pair wrong.

And then the idea that datreant is for organising more data than you could do manually, so the idea of adding manual prompts to the system seems strange.

But this is all opinion based, so I'll let someone else slap me down if they like this idea

@mimischi
Copy link
Author

I totally see your point. Maybe keeping the current functionality is better, as it would do one thing, and one thing only. Nevertheless, I still think that is something that other people would also like to have, maybe via dtr interactive --category CATEGORY1 CATEGORY2.

Looking forward to the others' insights.

@mimischi mimischi mentioned this pull request Oct 31, 2018
@dotsdl
Copy link
Member

dotsdl commented Nov 1, 2018

I'm in agreement with @richardjgowers: I think the usage you illustrated deserves an informative error message instead, since it looks to me like mistaken usage. Can we put out a good error message instead for this case of ValueError?

@mimischi
Copy link
Author

mimischi commented Nov 1, 2018

I'm fine with that!

But in any case, do you two see any possibility of having some interactive prompt in the CLI at all? At least for specialized functions that are advertised to do this. I've been migrating old non-datreant projects to datreant in the past few days and the functionality from this PR has sped up things so much for me.

@richardjgowers
Copy link

@mimischi as a compromise, how about a --interactive flag, which kills the error and allows for prompts?

@kain88-de
Copy link
Contributor

kain88-de commented Nov 2, 2018 via email

@mimischi
Copy link
Author

mimischi commented Nov 2, 2018

Yes, so this then goes in the same direction as #8. We should think about a reasonable CLI to not confuse users and provide them with a logical separation. I haven't thought about which of the two options is best.

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.

4 participants