User github.user config key instead of github.username
This commit is contained in:
parent
c76acdc81f
commit
82638e31bc
@ -6,7 +6,7 @@ create a template, you can use [`interactive_template`](@ref) instead.
|
|||||||
|
|
||||||
# Keyword Arguments
|
# Keyword Arguments
|
||||||
* `user::AbstractString="")`: GitHub username. If left unset, it will try to take the
|
* `user::AbstractString="")`: GitHub username. If left unset, it will try to take the
|
||||||
value of a supplied git config's "github.username" key, then the global git config's
|
value of a supplied git config's "github.user" key, then the global git config's
|
||||||
value. If neither is set, an `ArgumentError` is thrown.
|
value. If neither is set, an `ArgumentError` is thrown.
|
||||||
**This is case-sensitive for some plugins, so take care to enter it correctly.**
|
**This is case-sensitive for some plugins, so take care to enter it correctly.**
|
||||||
* `host::AbstractString="github.com"`: URL to the code hosting service where your package
|
* `host::AbstractString="github.com"`: URL to the code hosting service where your package
|
||||||
@ -70,8 +70,8 @@ don't belong.
|
|||||||
# and then in the global git config.
|
# and then in the global git config.
|
||||||
if isempty(user)
|
if isempty(user)
|
||||||
user = get(
|
user = get(
|
||||||
git_config, "github.username",
|
git_config, "github.user",
|
||||||
LibGit2.getconfig("github.username", ""),
|
LibGit2.getconfig("github.user", ""),
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
if isempty(user)
|
if isempty(user)
|
||||||
@ -132,7 +132,7 @@ function interactive_template(; fast::Bool=false)
|
|||||||
plugin_types = @spawn leaves(Plugin)
|
plugin_types = @spawn leaves(Plugin)
|
||||||
kwargs = Dict{Symbol, Any}()
|
kwargs = Dict{Symbol, Any}()
|
||||||
|
|
||||||
default_user = LibGit2.getconfig("github.username", "")
|
default_user = LibGit2.getconfig("github.user", "")
|
||||||
print("Enter your username [$(isempty(default_user) ? "REQUIRED" : default_user)]: ")
|
print("Enter your username [$(isempty(default_user) ? "REQUIRED" : default_user)]: ")
|
||||||
user = readline()
|
user = readline()
|
||||||
kwargs[:user] = if !isempty(user)
|
kwargs[:user] = if !isempty(user)
|
||||||
|
@ -13,7 +13,7 @@ const me = "christopher-dG"
|
|||||||
const git_config = Dict(
|
const git_config = Dict(
|
||||||
"user.name" => "Tester McTestFace",
|
"user.name" => "Tester McTestFace",
|
||||||
"user.email" => "email@web.site",
|
"user.email" => "email@web.site",
|
||||||
"github.username" => "TesterMcTestFace",
|
"github.user" => "TesterMcTestFace",
|
||||||
)
|
)
|
||||||
const test_pkg = "TestPkg"
|
const test_pkg = "TestPkg"
|
||||||
const fake_path = bin(hash("/this/file/does/not/exist"))
|
const fake_path = bin(hash("/this/file/does/not/exist"))
|
||||||
@ -94,7 +94,7 @@ write(test_file, template_text)
|
|||||||
|
|
||||||
t = Template(; git_config=git_config)
|
t = Template(; git_config=git_config)
|
||||||
rm(t.temp_dir; recursive=true)
|
rm(t.temp_dir; recursive=true)
|
||||||
@test t.user == git_config["github.username"]
|
@test t.user == git_config["github.user"]
|
||||||
@test t.authors == git_config["user.name"]
|
@test t.authors == git_config["user.name"]
|
||||||
|
|
||||||
t = Template(;
|
t = Template(;
|
||||||
@ -115,11 +115,11 @@ write(test_file, template_text)
|
|||||||
)
|
)
|
||||||
rm(t.temp_dir; recursive=true)
|
rm(t.temp_dir; recursive=true)
|
||||||
|
|
||||||
if isempty(LibGit2.getconfig("github.username", ""))
|
if isempty(LibGit2.getconfig("github.user", ""))
|
||||||
@test_throws ArgumentError t = Template()
|
@test_throws ArgumentError t = Template()
|
||||||
else
|
else
|
||||||
t = Template()
|
t = Template()
|
||||||
@test t.user == LibGit2.getconfig("github.username", "")
|
@test t.user == LibGit2.getconfig("github.user", "")
|
||||||
end
|
end
|
||||||
rm(t.temp_dir; force=true, recursive=true)
|
rm(t.temp_dir; force=true, recursive=true)
|
||||||
@test_throws ArgumentError t = Template(; user=me, license="FakeLicense")
|
@test_throws ArgumentError t = Template(; user=me, license="FakeLicense")
|
||||||
@ -208,7 +208,7 @@ end
|
|||||||
end
|
end
|
||||||
|
|
||||||
@testset "Badge generation" begin
|
@testset "Badge generation" begin
|
||||||
user = git_config["github.username"]
|
user = git_config["github.user"]
|
||||||
|
|
||||||
badge = Badge("A", "B", "C")
|
badge = Badge("A", "B", "C")
|
||||||
@test badge.hover == "A"
|
@test badge.hover == "A"
|
||||||
|
Loading…
Reference in New Issue
Block a user