Use Survey For Interactions With User #186

Merged
6543 merged 3 commits from 6543/tea:use-survey-for-interactions-with-user into master 2020-10-03 02:54:14 +00:00
Owner
No description provided.
6543 added this to the v0.5.0 milestone 2020-09-18 13:31:52 +00:00
6543 added the
kind
enhancement
status/needs-reviews
labels 2020-09-18 13:32:05 +00:00
techknowlogick approved these changes 2020-09-19 03:57:24 +00:00
Dismissed
6543 force-pushed use-survey-for-interactions-with-user from 2669822f59 to 8aa8fe84aa 2020-09-19 19:09:53 +00:00 Compare
Owner

What's the advantage to use the library than before?

What's the advantage to use the library than before?
Author
Owner

dont show password in terminal and better y/n prompts

can be used for multible choise to set labels on issues ...

dont show password in terminal and better y/n prompts can be used for multible choise to set labels on issues ...
6543 added 1 commit 2020-09-21 05:58:18 +00:00
Merge branch 'master' into use-survey-for-interactions-with-user
All checks were successful
continuous-integration/drone/pr Build is passing
6d25539251
6543 modified the milestone from v0.5.0 to v0.6.0 2020-09-24 10:44:38 +00:00
noerw requested changes 2020-09-26 13:14:08 +00:00
Dismissed
noerw left a comment
Member

Some suggestions.

Would it be in scope of this PR to also make use of survey in runPullsCreate() and runReleaseCreate()? I'd prefer that over introducing it halfway..

Some suggestions. Would it be in scope of this PR to also make use of survey in `runPullsCreate()` and `runReleaseCreate()`? I'd prefer that over introducing it halfway..
cmd/login.go Outdated
@ -115,3 +116,3 @@
return err
}
name = strings.ReplaceAll(strings.Title(parsedURL.Host), ".", "")
nameSuggestion := strings.ReplaceAll(strings.Title(parsedURL.Host), ".", "")
Member
  1. parsedURL.Host is empty, if user does not specify a protocol, ie gitea.com.
  2. why do you convert to camel case? i see no problem in using the raw hostname..
1. parsedURL.Host is empty, if user does not specify a protocol, ie `gitea.com`. 2. why do you convert to camel case? i see no problem in using the raw hostname..
cmd/login.go Outdated
@ -122,3 +123,2 @@
}
if len(strings.TrimSpace(stdin)) != 0 {
name = strings.TrimSpace(stdin)
if len(name) != 0 {
Member

this should be == 0?

this should be `== 0`?
cmd/login.go Outdated
@ -129,1 +128,3 @@
stdin = ""
var hasToken bool
promptYN := &survey.Confirm{
Message: "Do you have a token",
Member

Message: fmt.Sprintf("Access token (get it from %s/user/settings/applications)"

`Message: fmt.Sprintf("Access token (get it from %s/user/settings/applications)"`
Member

scratch that, i get it now. good idea to support both cases
Then please make it "Do you have an access token?"
And I'd make the default false, chances are low that user creates a token first and then calls tea login

scratch that, i get it now. good idea to support both cases Then please make it `"Do you have an access token?"` And I'd make the default `false`, chances are low that user creates a token first and then calls `tea login`
cmd/login.go Outdated
@ -152,2 +154,2 @@
if _, err := fmt.Scanln(&stdin); err != nil {
stdin = ""
var optSettings bool
promptYN = &survey.Confirm{
Member

I'm not sure if hiding sshkey & insecure flag is a good idea, it saves one just one prompt anyway..
As a user with non-standard ssh setup, the ssh setting will not be optional for me, and I'd likely miss it and wonder why tea isn't working properly..

I'm not sure if hiding sshkey & insecure flag is a good idea, it saves one just one prompt anyway.. As a user with non-standard ssh setup, the ssh setting will not be optional for me, and I'd likely miss it and wonder why tea isn't working properly..
6543 removed the
status/needs-reviews
label 2020-09-26 19:06:31 +00:00
Member

modules/git/auth.go Lines 95 to 106 in c1d725ed34
func promptUser(domain string) (string, error) {
reader := bufio.NewReader(os.Stdin)
fmt.Printf("%s username: ", domain)
username, err := reader.ReadString('\n')
return strings.TrimSpace(username), err
}
func promptPass(domain string) (string, error) {
fmt.Printf("%s password: ", domain)
pass, err := terminal.ReadPassword(0)
return string(pass), err
}
also has some custom prompts that could be replaced..

https://gitea.com/gitea/tea/src/commit/c1d725ed34a95159d6bea0815bcd3357f4505e65/modules/git/auth.go#L95-L106 also has some custom prompts that could be replaced..
Author
Owner

modules/git/auth.go Lines 95 to 106 in c1d725ed34
func promptUser(domain string) (string, error) {
reader := bufio.NewReader(os.Stdin)
fmt.Printf("%s username: ", domain)
username, err := reader.ReadString('\n')
return strings.TrimSpace(username), err
}
func promptPass(domain string) (string, error) {
fmt.Printf("%s password: ", domain)
pass, err := terminal.ReadPassword(0)
return string(pass), err
}
also has some custom prompts that could be replaced..

at this module should be no prompts at all :/

> https://gitea.com/gitea/tea/src/commit/c1d725ed34a95159d6bea0815bcd3357f4505e65/modules/git/auth.go#L95-L106 also has some custom prompts that could be replaced.. at this module should be no prompts at all :/
6543 force-pushed use-survey-for-interactions-with-user from 6d25539251 to 768ab64dbf 2020-10-02 16:12:21 +00:00 Compare
Author
Owner

@noerw rebased and changed by your suggestions :)

EDIT: it still will need 👀 again from your side i thin ;)

@noerw rebased and changed by your suggestions :) EDIT: it still will need :eyes: again from your side i thin ;)
noerw added 1 commit 2020-10-02 23:36:25 +00:00
fixes
All checks were successful
continuous-integration/drone/pr Build is passing
9ca55103ef
Member

i felt free to push to your branch directly.. ? lgtm now

i felt free to push to your branch directly.. ? lgtm now
noerw approved these changes 2020-10-02 23:38:54 +00:00
Dismissed
@ -27,3 +30,3 @@
}
name, err := config.GenerateLoginName(giteaURL, "")
parsedURL, err := url.Parse(giteaURL)
Member

you lost something here in the rebase.. please use config.GenerateLoginName() instead

you lost something here in the rebase.. please use `config.GenerateLoginName()` instead
Author
Owner

"Someone" added you to the fork to be able to do so, think it was intended ;)

"Someone" added you to the fork to be able to do so, think it was intended ;)
6543 merged commit 7ac3ffcc1b into master 2020-10-03 02:54:14 +00:00
6543 deleted branch use-survey-for-interactions-with-user 2020-10-03 02:54:26 +00:00
Sign in to join this conversation.
No description provided.