mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-10-31 18:48:08 +00:00
Read from stdin with auth command
This commit is contained in:
@@ -1,7 +1,9 @@
|
|||||||
package command
|
package command
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bufio"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io"
|
||||||
"os"
|
"os"
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
@@ -63,6 +65,17 @@ func (c *AuthCommand) Run(args []string) int {
|
|||||||
|
|
||||||
// token is where the final token will go
|
// token is where the final token will go
|
||||||
handler := c.Handlers[method]
|
handler := c.Handlers[method]
|
||||||
|
|
||||||
|
if len(args) > 0 && args[0] == "-" {
|
||||||
|
stdin := bufio.NewReader(os.Stdin)
|
||||||
|
args[0], err = stdin.ReadString('\n')
|
||||||
|
if err != nil && err != io.EOF {
|
||||||
|
c.Ui.Error(fmt.Sprintf("Error reading from stdin: %s", err))
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
args[0] = strings.TrimSpace(args[0])
|
||||||
|
}
|
||||||
|
|
||||||
if method == "" {
|
if method == "" {
|
||||||
token := ""
|
token := ""
|
||||||
if len(args) > 0 {
|
if len(args) > 0 {
|
||||||
|
|||||||
Reference in New Issue
Block a user