pflag -> cobra: Sub commands, completions, ...

Signed-off-by: Hadi <hadi@example.com>
This commit is contained in:
Hadi
2026-05-29 11:36:46 +02:00
parent 4922f3704d
commit 098400ba77
7 changed files with 165 additions and 135 deletions
+7 -6
View File
@@ -40,7 +40,6 @@ It is intentionally minimal. No Electron, no browser, no bloat. Just a fast, key
<img alt="demo" src="./.github/assets/demo.gif" width="700" /> <img alt="demo" src="./.github/assets/demo.gif" width="700" />
<!-- exec: cat ./docs/legal-disclaimer.md --> <!-- exec: cat ./docs/legal-disclaimer.md -->
## Legal Disclaimer ## Legal Disclaimer
**This tool is provided for educational purposes and authorized security testing only.** **This tool is provided for educational purposes and authorized security testing only.**
@@ -48,7 +47,6 @@ It is intentionally minimal. No Electron, no browser, no bloat. Just a fast, key
Use Spilltea only on systems and networks you own or have explicit written permission to test. Intercepting network traffic without authorization may violate local laws (such as the Computer Fraud and Abuse Act, GDPR, or equivalent legislation in your jurisdiction). Use Spilltea only on systems and networks you own or have explicit written permission to test. Intercepting network traffic without authorization may violate local laws (such as the Computer Fraud and Abuse Act, GDPR, or equivalent legislation in your jurisdiction).
The author(s) and contributors are not responsible for any misuse, damage, or legal consequences resulting from the use of this software. By using Spilltea, you agree that you are solely responsible for ensuring your usage is lawful and authorized. The author(s) and contributors are not responsible for any misuse, damage, or legal consequences resulting from the use of this software. By using Spilltea, you agree that you are solely responsible for ensuring your usage is lawful and authorized.
<!-- endexec --> <!-- endexec -->
## Features ## Features
@@ -103,7 +101,6 @@ environment.systemPackages = [ inputs.spilltea.packages.${pkgs.system}.default ]
</details> </details>
<!-- exec: cat ./docs/basics.md --> <!-- exec: cat ./docs/basics.md -->
## Project Management ## Project Management
Spilltea organizes work into **projects**. Each project maps to a SQLite database file that stores all intercepted traffic for that session & a log files. Spilltea organizes work into **projects**. Each project maps to a SQLite database file that stores all intercepted traffic for that session & a log files.
@@ -124,19 +121,23 @@ Colors and styles can be customized using [ilovetui](https://github.com/anotherh
## CLI Flags ## CLI Flags
``` ```
Usage: spilltea [flags] A minimal, terminal-based HTTP(S) proxy for pentesters and CTF players.
Usage:
spilltea [flags]
Flags:
--add-default-config copy the default config file to the config path and exit --add-default-config copy the default config file to the config path and exit
--add-default-plugins copy built-in example plugins into the plugins dir and exit --add-default-plugins copy built-in example plugins into the plugins dir and exit
-c, --config string path to config file -c, --config string path to config file
-h, --help help for spilltea
--host string proxy host (overrides config) --host string proxy host (overrides config)
--plugins-dir string path to plugins dir (overrides config) --plugins-dir string path to plugins dir (overrides config)
-p, --port int proxy port (overrides config) -p, --port int proxy port (overrides config)
-P, --project string project name to open directly, or "tmp" for a temporary session -P, --project string project name to open directly, or "tmp" for a temporary session
--upstream-proxy string upstream proxy URL, e.g. http://user:pass@host:8888 (overrides config) --upstream-proxy string upstream proxy URL, e.g. http://user:pass@host:8888 (overrides config)
-v, --version print version -v, --version version for spilltea
``` ```
<!-- endexec --> <!-- endexec -->
## Plugin System ## Plugin System
+67 -68
View File
@@ -15,7 +15,7 @@ import (
"github.com/anotherhadi/spilltea/internal/style" "github.com/anotherhadi/spilltea/internal/style"
appUI "github.com/anotherhadi/spilltea/internal/ui/app" appUI "github.com/anotherhadi/spilltea/internal/ui/app"
homeUI "github.com/anotherhadi/spilltea/internal/ui/home" homeUI "github.com/anotherhadi/spilltea/internal/ui/home"
flag "github.com/spf13/pflag" "github.com/spf13/cobra"
) )
// Version is overwritten at build time by goreleaser/ldflag with the current version tag, or "dev" if not set. // Version is overwritten at build time by goreleaser/ldflag with the current version tag, or "dev" if not set.
@@ -32,94 +32,83 @@ func init() {
func main() { func main() {
var ( var (
flagConfig = flag.StringP("config", "c", "", "path to config file") flagConfig string
flagPluginsDir = flag.String("plugins-dir", "", "path to plugins dir (overrides config)") flagPluginsDir string
flagHost = flag.String("host", "", "proxy host (overrides config)") flagHost string
flagPort = flag.IntP("port", "p", 0, "proxy port (overrides config)") flagPort int
flagUpstreamProxy = flag.String("upstream-proxy", "", "upstream proxy URL, e.g. http://user:pass@host:8888 (overrides config)") flagUpstreamProxy string
flagVersion = flag.BoolP("version", "v", false, "print version") flagProject string
flagProject = flag.StringP("project", "P", "", `project name to open directly, or "tmp" for a temporary session`) flagAddDefaultPlugins bool
flagAddDefaultPlugins = flag.Bool("add-default-plugins", false, "copy built-in example plugins into the plugins dir and exit") flagAddDefaultConfig bool
flagAddDefaultConfig = flag.Bool("add-default-config", false, "copy the default config file to the config path and exit")
) )
flag.CommandLine.SetOutput(os.Stdout)
flag.Usage = func() {
fmt.Println("Usage: spilltea [flags]")
fmt.Println("")
flag.PrintDefaults()
}
flag.Parse()
if *flagVersion { rootCmd := &cobra.Command{
fmt.Println(version) Use: "spilltea",
os.Exit(0) Short: "A minimal, terminal-based HTTP(S) proxy for pentesters and CTF players.",
} Version: version,
SilenceUsage: true,
if *flagAddDefaultPlugins { SilenceErrors: true,
RunE: func(cmd *cobra.Command, args []string) error {
if flagAddDefaultPlugins {
home, _ := os.UserHomeDir() home, _ := os.UserHomeDir()
cfgPath := filepath.Join(home, ".config", "spilltea", "config.yaml") cfgPath := filepath.Join(home, ".config", "spilltea", "config.yaml")
if *flagConfig != "" { if flagConfig != "" {
cfgPath = *flagConfig cfgPath = flagConfig
} }
if err := config.Load(cfgPath); err != nil { if err := config.Load(cfgPath); err != nil {
fmt.Fprintf(os.Stderr, "config: %v\n", err) return fmt.Errorf("config: %w", err)
os.Exit(1)
} }
dir := config.ExpandPath(config.Global.App.PluginsDir) dir := config.ExpandPath(config.Global.App.PluginsDir)
if *flagPluginsDir != "" { if flagPluginsDir != "" {
dir = *flagPluginsDir dir = flagPluginsDir
} }
n, err := spilltea.InstallDefaultPlugins(dir) n, err := spilltea.InstallDefaultPlugins(dir)
if err != nil { if err != nil {
fmt.Fprintf(os.Stderr, "add-default-plugins: %v\n", err) return fmt.Errorf("add-default-plugins: %w", err)
os.Exit(1)
} }
fmt.Printf("added %d plugin(s) to %s\n", n, dir) fmt.Printf("added %d plugin(s) to %s\n", n, dir)
os.Exit(0) return nil
} }
if *flagAddDefaultConfig { if flagAddDefaultConfig {
home, _ := os.UserHomeDir() home, _ := os.UserHomeDir()
cfgPath := filepath.Join(home, ".config", "spilltea", "config.yaml") cfgPath := filepath.Join(home, ".config", "spilltea", "config.yaml")
if *flagConfig != "" { if flagConfig != "" {
cfgPath = *flagConfig cfgPath = flagConfig
} }
if err := config.WriteDefaultConfig(cfgPath); err != nil { if err := config.WriteDefaultConfig(cfgPath); err != nil {
fmt.Fprintf(os.Stderr, "add-default-config: %v\n", err) return fmt.Errorf("add-default-config: %w", err)
os.Exit(1)
} }
fmt.Printf("default config written to %s\n", cfgPath) fmt.Printf("default config written to %s\n", cfgPath)
os.Exit(0) return nil
} }
if *flagProject != "" && !homeUI.IsValidProjectName(*flagProject) { if flagProject != "" && !homeUI.IsValidProjectName(flagProject) {
fmt.Fprintf(os.Stderr, "project: invalid name %q (only lowercase letters, digits, - and _ are allowed)\n", *flagProject) return fmt.Errorf("project: invalid name %q (only lowercase letters, digits, - and _ are allowed)", flagProject)
os.Exit(1)
} }
home, _ := os.UserHomeDir() home, _ := os.UserHomeDir()
cfgPath := filepath.Join(home, ".config", "spilltea", "config.yaml") cfgPath := filepath.Join(home, ".config", "spilltea", "config.yaml")
if *flagConfig != "" { if flagConfig != "" {
cfgPath = *flagConfig cfgPath = flagConfig
} }
if err := config.Load(cfgPath); err != nil { if err := config.Load(cfgPath); err != nil {
fmt.Fprintf(os.Stderr, "config: %v\n", err) return fmt.Errorf("config: %w", err)
os.Exit(1)
} }
config.Global.Version = version config.Global.Version = version
if *flagPluginsDir != "" { if flagPluginsDir != "" {
config.Global.App.PluginsDir = *flagPluginsDir config.Global.App.PluginsDir = flagPluginsDir
} }
if *flagHost != "" { if flagHost != "" {
config.Global.App.Host = *flagHost config.Global.App.Host = flagHost
} }
if *flagPort != 0 { if flagPort != 0 {
config.Global.App.Port = *flagPort config.Global.App.Port = flagPort
} }
if *flagUpstreamProxy != "" { if flagUpstreamProxy != "" {
config.Global.App.UpstreamProxy = *flagUpstreamProxy config.Global.App.UpstreamProxy = flagUpstreamProxy
} }
style.Init() style.Init()
@@ -128,40 +117,50 @@ func main() {
projectDir := config.ExpandPath(config.Global.App.ProjectDir) projectDir := config.ExpandPath(config.Global.App.ProjectDir)
// If --project flag is set, skip the home screen entirely. if flagProject != "" {
if *flagProject != "" { project, err := homeUI.OpenProject(projectDir, flagProject)
project, err := homeUI.OpenProject(projectDir, *flagProject)
if err != nil { if err != nil {
fmt.Fprintf(os.Stderr, "project: %v\n", err) return fmt.Errorf("project: %w", err)
os.Exit(1)
} }
broker := intercept.NewBroker() broker := intercept.NewBroker()
m := appUI.New(broker, project.Name, project.Path) m := appUI.New(broker, project.Name, project.Path)
final, err := tea.NewProgram(m).Run() final, err := tea.NewProgram(m).Run()
if err != nil { if err != nil {
fmt.Fprintf(os.Stderr, "tui: %v\n", err) return fmt.Errorf("tui: %w", err)
os.Exit(1)
} }
if app, ok := final.(appUI.Model); ok { if app, ok := final.(appUI.Model); ok {
if ferr := app.FatalErr(); ferr != nil { if ferr := app.FatalErr(); ferr != nil {
fmt.Fprintf(os.Stderr, "error: %v\n", ferr) return ferr
os.Exit(1)
} }
} }
return return nil
} }
// Run home + app in a single program to avoid a blank flash on transition.
root := rootModel{home: homeUI.New(projectDir)} root := rootModel{home: homeUI.New(projectDir)}
final, err := tea.NewProgram(root).Run() final, err := tea.NewProgram(root).Run()
if err != nil { if err != nil {
fmt.Fprintf(os.Stderr, "tui: %v\n", err) return fmt.Errorf("tui: %w", err)
os.Exit(1)
} }
if r, ok := final.(rootModel); ok { if r, ok := final.(rootModel); ok {
if ferr := r.FatalErr(); ferr != nil { if ferr := r.FatalErr(); ferr != nil {
fmt.Fprintf(os.Stderr, "error: %v\n", ferr) return ferr
}
}
return nil
},
}
rootCmd.Flags().StringVarP(&flagConfig, "config", "c", "", "path to config file")
rootCmd.Flags().StringVar(&flagPluginsDir, "plugins-dir", "", "path to plugins dir (overrides config)")
rootCmd.Flags().StringVar(&flagHost, "host", "", "proxy host (overrides config)")
rootCmd.Flags().IntVarP(&flagPort, "port", "p", 0, "proxy port (overrides config)")
rootCmd.Flags().StringVar(&flagUpstreamProxy, "upstream-proxy", "", "upstream proxy URL, e.g. http://user:pass@host:8888 (overrides config)")
rootCmd.Flags().StringVarP(&flagProject, "project", "P", "", `project name to open directly, or "tmp" for a temporary session`)
rootCmd.Flags().BoolVar(&flagAddDefaultPlugins, "add-default-plugins", false, "copy built-in example plugins into the plugins dir and exit")
rootCmd.Flags().BoolVar(&flagAddDefaultConfig, "add-default-config", false, "copy the default config file to the config path and exit")
if err := rootCmd.Execute(); err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1) os.Exit(1)
} }
} }
}
+7 -2
View File
@@ -19,16 +19,21 @@ Colors and styles can be customized using [ilovetui](https://github.com/anotherh
<!-- exec: echo '```' && go run ./cmd/spilltea -h && echo '```' --> <!-- exec: echo '```' && go run ./cmd/spilltea -h && echo '```' -->
``` ```
Usage: spilltea [flags] A minimal, terminal-based HTTP(S) proxy for pentesters and CTF players.
Usage:
spilltea [flags]
Flags:
--add-default-config copy the default config file to the config path and exit --add-default-config copy the default config file to the config path and exit
--add-default-plugins copy built-in example plugins into the plugins dir and exit --add-default-plugins copy built-in example plugins into the plugins dir and exit
-c, --config string path to config file -c, --config string path to config file
-h, --help help for spilltea
--host string proxy host (overrides config) --host string proxy host (overrides config)
--plugins-dir string path to plugins dir (overrides config) --plugins-dir string path to plugins dir (overrides config)
-p, --port int proxy port (overrides config) -p, --port int proxy port (overrides config)
-P, --project string project name to open directly, or "tmp" for a temporary session -P, --project string project name to open directly, or "tmp" for a temporary session
--upstream-proxy string upstream proxy URL, e.g. http://user:pass@host:8888 (overrides config) --upstream-proxy string upstream proxy URL, e.g. http://user:pass@host:8888 (overrides config)
-v, --version print version -v, --version version for spilltea
``` ```
<!-- endexec --> <!-- endexec -->
+3 -1
View File
@@ -1,6 +1,6 @@
module github.com/anotherhadi/spilltea module github.com/anotherhadi/spilltea
go 1.26.3 go 1.26.2
require ( require (
charm.land/bubbles/v2 v2.1.0 charm.land/bubbles/v2 v2.1.0
@@ -41,6 +41,7 @@ require (
github.com/google/uuid v1.6.0 // indirect github.com/google/uuid v1.6.0 // indirect
github.com/gorilla/css v1.0.1 // indirect github.com/gorilla/css v1.0.1 // indirect
github.com/gorilla/websocket v1.5.0 // indirect github.com/gorilla/websocket v1.5.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/lucasb-eyer/go-colorful v1.4.0 // indirect github.com/lucasb-eyer/go-colorful v1.4.0 // indirect
github.com/mattn/go-isatty v0.0.22 // indirect github.com/mattn/go-isatty v0.0.22 // indirect
github.com/mattn/go-runewidth v0.0.23 // indirect github.com/mattn/go-runewidth v0.0.23 // indirect
@@ -55,6 +56,7 @@ require (
github.com/satori/go.uuid v1.2.0 // indirect github.com/satori/go.uuid v1.2.0 // indirect
github.com/spf13/afero v1.15.0 // indirect github.com/spf13/afero v1.15.0 // indirect
github.com/spf13/cast v1.10.0 // indirect github.com/spf13/cast v1.10.0 // indirect
github.com/spf13/cobra v1.10.2 // indirect
github.com/subosito/gotenv v1.6.0 // indirect github.com/subosito/gotenv v1.6.0 // indirect
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
github.com/yuin/goldmark v1.8.2 // indirect github.com/yuin/goldmark v1.8.2 // indirect
+7
View File
@@ -44,6 +44,7 @@ github.com/clipperhouse/displaywidth v0.11.0 h1:lBc6kY44VFw+TDx4I8opi/EtL9m20WSE
github.com/clipperhouse/displaywidth v0.11.0/go.mod h1:bkrFNkf81G8HyVqmKGxsPufD3JhNl3dSqnGhOoSD/o0= github.com/clipperhouse/displaywidth v0.11.0/go.mod h1:bkrFNkf81G8HyVqmKGxsPufD3JhNl3dSqnGhOoSD/o0=
github.com/clipperhouse/uax29/v2 v2.7.0 h1:+gs4oBZ2gPfVrKPthwbMzWZDaAFPGYK72F0NJv2v7Vk= github.com/clipperhouse/uax29/v2 v2.7.0 h1:+gs4oBZ2gPfVrKPthwbMzWZDaAFPGYK72F0NJv2v7Vk=
github.com/clipperhouse/uax29/v2 v2.7.0/go.mod h1:EFJ2TJMRUaplDxHKj1qAEhCtQPW2tJSwu5BF98AuoVM= github.com/clipperhouse/uax29/v2 v2.7.0/go.mod h1:EFJ2TJMRUaplDxHKj1qAEhCtQPW2tJSwu5BF98AuoVM=
github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dlclark/regexp2 v1.12.0 h1:0j4c5qQmnC6XOWNjP3PIXURXN2gWx76rd3KvgdPkCz8= github.com/dlclark/regexp2 v1.12.0 h1:0j4c5qQmnC6XOWNjP3PIXURXN2gWx76rd3KvgdPkCz8=
@@ -72,6 +73,8 @@ github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs
github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM= github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM=
github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM= github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM=
github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg= github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg=
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/klauspost/compress v1.17.8 h1:YcnTYrq7MikUT7k0Yb5eceMmALQPYBW/Xltxn0NAMnU= github.com/klauspost/compress v1.17.8 h1:YcnTYrq7MikUT7k0Yb5eceMmALQPYBW/Xltxn0NAMnU=
github.com/klauspost/compress v1.17.8/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= github.com/klauspost/compress v1.17.8/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
@@ -104,6 +107,7 @@ github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/sagikazarmark/locafero v0.12.0 h1:/NQhBAkUb4+fH1jivKHWusDYFjMOOKU88eegjfxfHb4= github.com/sagikazarmark/locafero v0.12.0 h1:/NQhBAkUb4+fH1jivKHWusDYFjMOOKU88eegjfxfHb4=
github.com/sagikazarmark/locafero v0.12.0/go.mod h1:sZh36u/YSZ918v0Io+U9ogLYQJ9tLLBmM4eneO6WwsI= github.com/sagikazarmark/locafero v0.12.0/go.mod h1:sZh36u/YSZ918v0Io+U9ogLYQJ9tLLBmM4eneO6WwsI=
github.com/sahilm/fuzzy v0.1.1 h1:ceu5RHF8DGgoi+/dR5PsECjCDH1BE3Fnmpo7aVXOdRA= github.com/sahilm/fuzzy v0.1.1 h1:ceu5RHF8DGgoi+/dR5PsECjCDH1BE3Fnmpo7aVXOdRA=
@@ -116,6 +120,9 @@ github.com/spf13/afero v1.15.0 h1:b/YBCLWAJdFWJTN9cLhiXXcD7mzKn9Dm86dNnfyQw1I=
github.com/spf13/afero v1.15.0/go.mod h1:NC2ByUVxtQs4b3sIUphxK0NioZnmxgyCrfzeuq8lxMg= github.com/spf13/afero v1.15.0/go.mod h1:NC2ByUVxtQs4b3sIUphxK0NioZnmxgyCrfzeuq8lxMg=
github.com/spf13/cast v1.10.0 h1:h2x0u2shc1QuLHfxi+cTJvs30+ZAHOGRic8uyGTDWxY= github.com/spf13/cast v1.10.0 h1:h2x0u2shc1QuLHfxi+cTJvs30+ZAHOGRic8uyGTDWxY=
github.com/spf13/cast v1.10.0/go.mod h1:jNfB8QC9IA6ZuY2ZjDp0KtFO2LZZlg4S/7bzP6qqeHo= github.com/spf13/cast v1.10.0/go.mod h1:jNfB8QC9IA6ZuY2ZjDp0KtFO2LZZlg4S/7bzP6qqeHo=
github.com/spf13/cobra v1.10.2 h1:DMTTonx5m65Ic0GOoRY2c16WCbHxOOw6xxezuLaBpcU=
github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiTUUS4=
github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk= github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk=
github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/spf13/viper v1.21.0 h1:x5S+0EU27Lbphp4UKm1C+1oQO+rKx36vfCoaVebLFSU= github.com/spf13/viper v1.21.0 h1:x5S+0EU27Lbphp4UKm1C+1oQO+rKx36vfCoaVebLFSU=
+8
View File
@@ -105,6 +105,10 @@ schema = 3
version = 'v1.5.0' version = 'v1.5.0'
hash = 'sha256-EYVgkSEMo4HaVrsWKqnsYRp8SSS8gNf7t+Elva02Ofc=' hash = 'sha256-EYVgkSEMo4HaVrsWKqnsYRp8SSS8gNf7t+Elva02Ofc='
[mod.'github.com/inconshreveable/mousetrap']
version = 'v1.1.0'
hash = 'sha256-XWlYH0c8IcxAwQTnIi6WYqq44nOKUylSWxWO/vi+8pE='
[mod.'github.com/klauspost/compress'] [mod.'github.com/klauspost/compress']
version = 'v1.17.8' version = 'v1.17.8'
hash = 'sha256-8rgCCfHX29le8m6fyVn6gwFde5TPUHjwQqZqv9JIubs=' hash = 'sha256-8rgCCfHX29le8m6fyVn6gwFde5TPUHjwQqZqv9JIubs='
@@ -173,6 +177,10 @@ schema = 3
version = 'v1.10.0' version = 'v1.10.0'
hash = 'sha256-dQ6Qqf26IZsa6XsGKP7GDuCj+WmSsBmkBwGTDfue/rk=' hash = 'sha256-dQ6Qqf26IZsa6XsGKP7GDuCj+WmSsBmkBwGTDfue/rk='
[mod.'github.com/spf13/cobra']
version = 'v1.10.2'
hash = 'sha256-nbRCTFiDCC2jKK7AHi79n7urYCMP5yDZnWtNVJrDi+k='
[mod.'github.com/spf13/pflag'] [mod.'github.com/spf13/pflag']
version = 'v1.0.10' version = 'v1.0.10'
hash = 'sha256-uDPnWjHpSrzXr17KEYEA1yAbizfcsfo5AyztY2tS6ZU=' hash = 'sha256-uDPnWjHpSrzXr17KEYEA1yAbizfcsfo5AyztY2tS6ZU='
+8
View File
@@ -9,6 +9,14 @@
inherit pname version ldflags; inherit pname version ldflags;
src = ../.; src = ../.;
modules = ./gomod2nix.toml; modules = ./gomod2nix.toml;
nativeBuildInputs = [ pkgs.installShellFiles ];
env.GOTOOLCHAIN = "local";
postInstall = ''
installShellCompletion --cmd spilltea \
--bash <($out/bin/spilltea completion bash) \
--zsh <($out/bin/spilltea completion zsh) \
--fish <($out/bin/spilltea completion fish)
'';
meta = with pkgs.lib; { meta = with pkgs.lib; {
description = "A minimal, terminal-based HTTP(S) proxy for pentesters and CTF players."; description = "A minimal, terminal-based HTTP(S) proxy for pentesters and CTF players.";
homepage = "https://github.com/anotherhadi/spilltea"; homepage = "https://github.com/anotherhadi/spilltea";