Closed xpol closed 8 years ago
Sorry I'm tested on windows and I never use ssh key...
Looks like we could use some better error reporting here. But you will be unable to publish to the lit server without an ssh key tied to your github account.
As far as username, lit-init should prompt for any missing data instead of crashing. @james2doyle or @squeek502, do either of you have a moment to help with this?
Yeah I have a minute
Should this new check or guard be added to commands/init.lua
?
Lit init calls core.config
, and core.config
calls autoconfig
, so I'm not sure where to do this check.
Autoconfig shouldn't require a username since it's global. The init command should prompt for it if missing like the auth command does.
This patch should work:
@@ -65,11 +65,12 @@ return function ()
-- trim trailing comma and space
tags = tags:sub(0, (#tags - 2))
return tags .. " }"
end
- local projectName = prompt("Project Name", config["username"] .. "/project-name")
+ local userName = prompt("Username", config["username"])
+ local projectName = prompt("Project Name", userName .. "/project-name")
local projectVersion = prompt("Version", "0.0.1")
local projectDescription = prompt("Description", "A simple description of my little package.")
local projectTags = makeTags(prompt("Tags (Comma Separated)", "lua, lit, luvit"))
local authorName = prompt("Author Name", getConfig("user.name"))
local authorEmail = prompt("Author Email", getConfig("user.email"))
Let me know if you'd like me to submit it as a PR.
@squeek502 Stolen!
:smile:
Here's an alternative fix, because username isn't actually used for anything except the project name prompt:
- local projectName = prompt("Project Name", config["username"] .. "/project-name")
+ local projectName = prompt("Project Name", (config["username"] or "username") .. "/project-name")
Not sure which is better. Here's a comparison between what the prompts look like when config["username"]
is nil.
First fix:
Creating: package.lua
Username: squeek502
Project Name: (squeek502/project-name) squeek502/test
Alt fix:
Creating: package.lua
Project Name: (username/project-name) squeek502/test
I like the first fix personally. It emulates how npm|bower init
work
@creationix
Added ssh key under windows works for me. We should add a setup instructions in https://luvit.io/install.html (or a seprated guide), some steps like.
lit auth <you github username>
I just installed lit on Windows and run
lit init
got the follow error: