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

Make the template values selection more interactive #12

Closed
wants to merge 1 commit into from

Conversation

ffevotte
Copy link
Contributor

This PR makes the selection of templates parameters more interactive. Git-config is used to retrieve default values, which are then interactively proposed to be validated (or amended) by the user. A final confirmation is asked before going on with the project configuration as usual.

julia> PkgSkeleton.generate("Foo")
[ Info: getting template values
Confirm default values by pressing RETURN, or enter a customized value
Author name (John Doe)>
Author email (johndoe@gmail.com)> john.doe@example.com
Github user name ()> jdoe
Copyright year (2019)> 
┌ Info: parameters:
│   {UUID} = UUID("1a7ac041-bdf1-4da1-9e3a-91f6f6c88e92")
│   {PKGNAME} = "Foo"
│   {USERNAME} = "John Doe"
│   {USEREMAIL} = "[email protected]"
│   {GHUSER} = "jdoe"
└   {YEAR} = 2019
Confirm (Y)> 
[ Info: copy and substitute
...

My use case for this is that on my home computer, I can't set up a global git-config identity: depending on which project I work on, I use either my personal email address or my professional one.

I'm not sure this PR is entirely in line with what you had in mind, though. Please feel free to comment / criticize / reject it!

And, as always, thank you for your work on this!

@codecov
Copy link

codecov bot commented Nov 10, 2019

Codecov Report

Merging #12 into master will decrease coverage by 11.86%.
The diff coverage is 53.33%.

Impacted file tree graph

@@             Coverage Diff             @@
##           master      #12       +/-   ##
===========================================
- Coverage     100%   88.13%   -11.87%     
===========================================
  Files           1        1               
  Lines          46       59       +13     
===========================================
+ Hits           46       52        +6     
- Misses          0        7        +7
Impacted Files Coverage Δ
src/PkgSkeleton.jl 88.13% <53.33%> (-11.87%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ffb2e84...61197dd. Read the comment docs.

@tpapp
Copy link
Owner

tpapp commented Nov 22, 2019

I think that allowing customization would make sense, but I would prefer that to happen as arguments to PkgSkeleton.generate instead of an interactive prompt.

@ffevotte
Copy link
Contributor Author

Well, it's entirely up to you!

And what about arguments to PkgSkeleton.generate, alongside a new entry point (perhaps PkgSkeleton.interactive()) that would interactively prompt for values before calling generate?

@tpapp
Copy link
Owner

tpapp commented Nov 22, 2019

Sorry, I would prefer to avoid interactive prompts if possible; they are quite hard to unit test and I think that just providing keyword arguments would serve a similar purpose.

@tpapp
Copy link
Owner

tpapp commented Feb 25, 2020

I implemented more customizations in #21. With that API, you can do

import PkgSkeleton
# you can also prompt for these interactively
replacements = (GHUSER = "jdoe", USERNAME = "John Doe")
PkgSkeleton.generate("/path/to/SomePackage.jl"; replacements = replacements)

I am sorry that I am reluctant to include interactive prompts in this package, but they really complicate code and testing.

I am closing this in favor of that PR, thanks for the suggestion.

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