mirror of
https://github.com/go-task/task.git
synced 2025-11-23 22:24:45 +02:00
feat: remote taskfiles (HTTP) (#1152)
* feat: remote taskfiles over http * feat: allow insecure connections when --insecure flag is provided * feat: better error handling for fetch errors * fix: ensure cache directory always exists * fix: setup logger before everything else * feat: put remote taskfiles behind an experiment * feat: --download and --offline flags for remote taskfiles * feat: node.Read accepts a context * feat: experiment docs * chore: changelog * chore: remove unused optional param from Node interface * chore: tidy up and generalise NewNode function * fix: use sha256 in remote checksum * feat: --download by itself will not run a task * feat: custom error if remote taskfiles experiment is not enabled * refactor: BaseNode functional options and simplified FileNode * fix: use hex encoding for checksum instead of b64
This commit is contained in:
@@ -1,11 +1,14 @@
|
||||
package logger
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"io"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/fatih/color"
|
||||
"golang.org/x/exp/slices"
|
||||
)
|
||||
|
||||
type (
|
||||
@@ -104,3 +107,17 @@ func (l *Logger) VerboseErrf(color Color, s string, args ...any) {
|
||||
l.Errf(color, s, args...)
|
||||
}
|
||||
}
|
||||
|
||||
func (l *Logger) Prompt(color Color, s string, defaultValue string, continueValues ...string) (bool, error) {
|
||||
if len(continueValues) == 0 {
|
||||
return false, nil
|
||||
}
|
||||
l.Outf(color, "%s [%s/%s]\n", s, strings.ToLower(continueValues[0]), strings.ToUpper(defaultValue))
|
||||
reader := bufio.NewReader(os.Stdin)
|
||||
input, err := reader.ReadString('\n')
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
input = strings.TrimSpace(strings.ToLower(input))
|
||||
return slices.Contains(continueValues, input), nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user