formatting
This commit is contained in:
parent
d7dfbd221f
commit
221de5c509
2
apply.go
2
apply.go
@ -20,7 +20,7 @@ func bindKeyVals(receiver reflect.Value, keyVals map[string][]string) bool {
|
||||
func bindOptions(receiver reflect.Value, shortForms []string, o []option) bool {
|
||||
ms := make(map[string]string)
|
||||
for i := 0; i < len(shortForms); i += 2 {
|
||||
ms[shortForms[i]] = shortForms[i + 1]
|
||||
ms[shortForms[i]] = shortForms[i+1]
|
||||
}
|
||||
|
||||
v := make(map[string][]any)
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
package wand
|
||||
|
||||
import (
|
||||
"code.squareroundforest.org/arpio/bind"
|
||||
"errors"
|
||||
"fmt"
|
||||
"reflect"
|
||||
"regexp"
|
||||
"code.squareroundforest.org/arpio/bind"
|
||||
)
|
||||
|
||||
var commandNameExpression = regexp.MustCompile("^[a-zA-Z_][a-zA-Z_0-9]*$")
|
||||
@ -224,13 +224,13 @@ func validateShortFormsTree(cmd Cmd) (map[string]string, map[string]string, erro
|
||||
}
|
||||
}
|
||||
|
||||
if len(cmd.shortForms) % 2 != 0 {
|
||||
return nil, nil, fmt.Errorf("unassigned short form: %s", cmd.shortForms[len(cmd.shortForms) - 1])
|
||||
if len(cmd.shortForms)%2 != 0 {
|
||||
return nil, nil, fmt.Errorf("unassigned short form: %s", cmd.shortForms[len(cmd.shortForms)-1])
|
||||
}
|
||||
|
||||
mf := mapFields(cmd.impl)
|
||||
for i := 0; i < len(cmd.shortForms); i += 2 {
|
||||
s, l := cmd.shortForms[i], cmd.shortForms[i + 1]
|
||||
s, l := cmd.shortForms[i], cmd.shortForms[i+1]
|
||||
r := []rune(s)
|
||||
if len(r) != 1 || r[0] < 'a' || r[0] > 'z' {
|
||||
return nil, nil, fmt.Errorf("invalid short form: %s", s)
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
package wand
|
||||
|
||||
import (
|
||||
"code.squareroundforest.org/arpio/bind"
|
||||
"slices"
|
||||
"strconv"
|
||||
"strings"
|
||||
"unicode"
|
||||
"code.squareroundforest.org/arpio/bind"
|
||||
)
|
||||
|
||||
type value struct {
|
||||
@ -281,7 +281,7 @@ func hasHelpOption(cmd Cmd, o []option) bool {
|
||||
|
||||
sf := make(map[string]string)
|
||||
for i := 0; i < len(cmd.shortForms); i += 2 {
|
||||
sf[cmd.shortForms[i]] = cmd.shortForms[i + 1]
|
||||
sf[cmd.shortForms[i]] = cmd.shortForms[i+1]
|
||||
}
|
||||
|
||||
for _, oi := range o {
|
||||
|
||||
@ -2,30 +2,31 @@
|
||||
Generated with https://code.squareroundforest.org/arpio/docreflect
|
||||
*/
|
||||
|
||||
|
||||
package wand
|
||||
|
||||
import "code.squareroundforest.org/arpio/docreflect"
|
||||
|
||||
func init() {
|
||||
docreflect.Register("code.squareroundforest.org/arpio/wand/tools", "")
|
||||
docreflect.Register("code.squareroundforest.org/arpio/wand/tools.Docreflect", "\nfunc(out, packageName, gopaths)")
|
||||
docreflect.Register("code.squareroundforest.org/arpio/wand/tools.Exec", "\nfunc(o, stdin, args)")
|
||||
docreflect.Register("code.squareroundforest.org/arpio/wand/tools.ExecOptions", "")
|
||||
docreflect.Register("code.squareroundforest.org/arpio/wand/tools.ExecOptions.CacheDir", "")
|
||||
docreflect.Register("code.squareroundforest.org/arpio/wand/tools.ExecOptions.ClearCache", "")
|
||||
docreflect.Register("code.squareroundforest.org/arpio/wand/tools.ExecOptions.Import", "")
|
||||
docreflect.Register("code.squareroundforest.org/arpio/wand/tools.ExecOptions.InlineImport", "")
|
||||
docreflect.Register("code.squareroundforest.org/arpio/wand/tools.ExecOptions.NoCache", "")
|
||||
docreflect.Register("code.squareroundforest.org/arpio/wand/tools.Man", "\nfunc(out, commandDir)")
|
||||
docreflect.Register("code.squareroundforest.org/arpio/wand/tools.Markdown", "\nfunc(out, o, commandDir)")
|
||||
docreflect.Register("code.squareroundforest.org/arpio/wand/tools.MarkdownOptions", "")
|
||||
docreflect.Register("code.squareroundforest.org/arpio/wand/tools.MarkdownOptions.Level", "")
|
||||
docreflect.Register("code.squareroundforest.org/arpio/wand/tools.commandReader", "\nfunc(in)")
|
||||
docreflect.Register("code.squareroundforest.org/arpio/wand/tools.execCommandDir", "\nfunc(out, commandDir, env)")
|
||||
docreflect.Register("code.squareroundforest.org/arpio/wand/tools.execInternal", "\nfunc(command, args)")
|
||||
docreflect.Register("code.squareroundforest.org/arpio/wand/tools.execTransparent", "\nfunc(command, args)")
|
||||
docreflect.Register("code.squareroundforest.org/arpio/wand/tools.execWand", "\nfunc(o, args)")
|
||||
docreflect.Register("code.squareroundforest.org/arpio/wand/tools.execc", "\nfunc(stdin, stdout, stderr, command, args, env)")
|
||||
docreflect.Register("code.squareroundforest.org/arpio/wand/tools.hash", "\nfunc(expression, imports, inlineImports)")
|
||||
docreflect.Register("code.squareroundforest.org/arpio/wand/tools.printGoFile", "\nfunc(fn, expression, imports, inlineImports)")
|
||||
docreflect.Register("code.squareroundforest.org/arpio/wand/tools.readExec", "\nfunc(o, stdin)")
|
||||
}
|
||||
docreflect.Register("code.squareroundforest.org/arpio/wand/tools", "")
|
||||
docreflect.Register("code.squareroundforest.org/arpio/wand/tools.Docreflect", "\nfunc(out, packageName, gopaths)")
|
||||
docreflect.Register("code.squareroundforest.org/arpio/wand/tools.Exec", "\nfunc(o, stdin, args)")
|
||||
docreflect.Register("code.squareroundforest.org/arpio/wand/tools.ExecOptions", "")
|
||||
docreflect.Register("code.squareroundforest.org/arpio/wand/tools.ExecOptions.CacheDir", "")
|
||||
docreflect.Register("code.squareroundforest.org/arpio/wand/tools.ExecOptions.ClearCache", "")
|
||||
docreflect.Register("code.squareroundforest.org/arpio/wand/tools.ExecOptions.Import", "")
|
||||
docreflect.Register("code.squareroundforest.org/arpio/wand/tools.ExecOptions.InlineImport", "")
|
||||
docreflect.Register("code.squareroundforest.org/arpio/wand/tools.ExecOptions.NoCache", "")
|
||||
docreflect.Register("code.squareroundforest.org/arpio/wand/tools.Man", "\nfunc(out, commandDir)")
|
||||
docreflect.Register("code.squareroundforest.org/arpio/wand/tools.Markdown", "\nfunc(out, o, commandDir)")
|
||||
docreflect.Register("code.squareroundforest.org/arpio/wand/tools.MarkdownOptions", "")
|
||||
docreflect.Register("code.squareroundforest.org/arpio/wand/tools.MarkdownOptions.Level", "")
|
||||
docreflect.Register("code.squareroundforest.org/arpio/wand/tools.commandReader", "\nfunc(in)")
|
||||
docreflect.Register("code.squareroundforest.org/arpio/wand/tools.execCommandDir", "\nfunc(out, commandDir, env)")
|
||||
docreflect.Register("code.squareroundforest.org/arpio/wand/tools.execInternal", "\nfunc(command, args)")
|
||||
docreflect.Register("code.squareroundforest.org/arpio/wand/tools.execTransparent", "\nfunc(command, args)")
|
||||
docreflect.Register("code.squareroundforest.org/arpio/wand/tools.execWand", "\nfunc(o, args)")
|
||||
docreflect.Register("code.squareroundforest.org/arpio/wand/tools.execc", "\nfunc(stdin, stdout, stderr, command, args, env)")
|
||||
docreflect.Register("code.squareroundforest.org/arpio/wand/tools.hash", "\nfunc(expression, imports, inlineImports)")
|
||||
docreflect.Register("code.squareroundforest.org/arpio/wand/tools.printGoFile", "\nfunc(fn, expression, imports, inlineImports)")
|
||||
docreflect.Register("code.squareroundforest.org/arpio/wand/tools.readExec", "\nfunc(o, stdin)")
|
||||
}
|
||||
|
||||
2
help.go
2
help.go
@ -1,8 +1,8 @@
|
||||
package wand
|
||||
|
||||
import (
|
||||
"code.squareroundforest.org/arpio/docreflect"
|
||||
"code.squareroundforest.org/arpio/bind"
|
||||
"code.squareroundforest.org/arpio/docreflect"
|
||||
"fmt"
|
||||
"io"
|
||||
"reflect"
|
||||
|
||||
385
iniparser.gen.go
385
iniparser.gen.go
File diff suppressed because one or more lines are too long
2
input.go
2
input.go
@ -1,9 +1,9 @@
|
||||
package wand
|
||||
|
||||
import (
|
||||
"code.squareroundforest.org/arpio/bind"
|
||||
"fmt"
|
||||
"reflect"
|
||||
"code.squareroundforest.org/arpio/bind"
|
||||
)
|
||||
|
||||
func validateKeyValues(cmd Cmd, keyValues map[string][]string, originalNames map[string]string) error {
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
package wand
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"code.squareroundforest.org/arpio/bind"
|
||||
"io"
|
||||
"time"
|
||||
"reflect"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
func filter[T any](list []T, predicate func(T) bool) []T {
|
||||
@ -297,7 +297,7 @@ func bindable(t reflect.Type) bool {
|
||||
func scalarTypeString(t bind.Scalar) string {
|
||||
r := reflect.TypeOf(t)
|
||||
p := strings.Split(r.Name(), ".")
|
||||
n := p[len(p) - 1]
|
||||
n := p[len(p)-1]
|
||||
n = strings.ToLower(n)
|
||||
return n
|
||||
}
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"code.squareroundforest.org/arpio/wand/tools"
|
||||
"log"
|
||||
"os"
|
||||
"code.squareroundforest.org/arpio/wand/tools"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
package tools
|
||||
|
||||
import (
|
||||
"io"
|
||||
"strings"
|
||||
"os/exec"
|
||||
"os"
|
||||
"bytes"
|
||||
"io"
|
||||
"os"
|
||||
"os/exec"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func execc(stdin io.Reader, stdout, stderr io.Writer, command string, args []string, env []string) error {
|
||||
|
||||
@ -1,33 +1,33 @@
|
||||
package tools
|
||||
|
||||
import (
|
||||
"io"
|
||||
"bufio"
|
||||
"errors"
|
||||
"fmt"
|
||||
"unicode"
|
||||
"hash/fnv"
|
||||
"bytes"
|
||||
"encoding/base64"
|
||||
"strings"
|
||||
"errors"
|
||||
"fmt"
|
||||
"hash/fnv"
|
||||
"io"
|
||||
"os"
|
||||
"sort"
|
||||
"path"
|
||||
"sort"
|
||||
"strings"
|
||||
"unicode"
|
||||
)
|
||||
|
||||
type ExecOptions struct {
|
||||
NoCache bool
|
||||
ClearCache bool
|
||||
CacheDir string
|
||||
Import []string
|
||||
NoCache bool
|
||||
ClearCache bool
|
||||
CacheDir string
|
||||
Import []string
|
||||
InlineImport []string
|
||||
}
|
||||
|
||||
func commandReader(in io.Reader) func() ([]string, error) {
|
||||
var (
|
||||
yieldErr error
|
||||
currentArg []rune
|
||||
args []string
|
||||
yieldErr error
|
||||
currentArg []rune
|
||||
args []string
|
||||
escapeOne, escapePartial, escapeFull bool
|
||||
)
|
||||
|
||||
|
||||
@ -2,8 +2,8 @@ package tools
|
||||
|
||||
import (
|
||||
"code.squareroundforest.org/arpio/docreflect/generate"
|
||||
"io"
|
||||
"fmt"
|
||||
"io"
|
||||
)
|
||||
|
||||
type MarkdownOptions struct {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user