mirror of https://github.com/mum4k/termdash.git
Self-review.
This commit is contained in:
parent
ba6224f5ae
commit
c3be258da0
|
@ -37,7 +37,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
|
|
||||||
#### Text input form functionality with keyboard navigation
|
#### Text input form functionality with keyboard navigation
|
||||||
|
|
||||||
- added a new `formdemo` that demonstrates the text input form with keyboard
|
- added a new `formdemo` that demonstrates a text input form with keyboard
|
||||||
navigation.
|
navigation.
|
||||||
|
|
||||||
#### Infrastructure changes
|
#### Infrastructure changes
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright 2019 Google Inc.
|
// Copyright 2020 Google Inc.
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
// you may not use this file except in compliance with the License.
|
// you may not use this file except in compliance with the License.
|
||||||
|
@ -68,18 +68,25 @@ func buttonChunks(text string) []*button.TextChunk {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// form contains the elements of a text input form
|
// form contains the elements of a text input form.
|
||||||
type form struct {
|
type form struct {
|
||||||
|
// userInput is a text input that accepts user name.
|
||||||
userInput *textinput.TextInput
|
userInput *textinput.TextInput
|
||||||
uidInput *textinput.TextInput
|
// uidInput is a text input that accepts UID.
|
||||||
gidInput *textinput.TextInput
|
uidInput *textinput.TextInput
|
||||||
|
// gidInput is a text input that accepts GID.
|
||||||
|
gidInput *textinput.TextInput
|
||||||
|
// homeInput is a text input that accepts path to the home folder.
|
||||||
homeInput *textinput.TextInput
|
homeInput *textinput.TextInput
|
||||||
submitB *button.Button
|
|
||||||
cancelB *button.Button
|
// submitB is a button that submits the form.
|
||||||
|
submitB *button.Button
|
||||||
|
// cancelB is a button that exist the application.
|
||||||
|
cancelB *button.Button
|
||||||
}
|
}
|
||||||
|
|
||||||
// newForm returns a new form instance.
|
// newForm returns a new form instance.
|
||||||
// The cancel argument is a function that terminates Termdash when called.
|
// The cancel argument is a function that terminates the application when called.
|
||||||
func newForm(cancel context.CancelFunc) (*form, error) {
|
func newForm(cancel context.CancelFunc) (*form, error) {
|
||||||
var username string
|
var username string
|
||||||
u, err := user.Current()
|
u, err := user.Current()
|
||||||
|
|
Loading…
Reference in New Issue