feat: add persistent proxy profile management
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
|
||||
tea "github.com/charmbracelet/bubbletea"
|
||||
|
||||
"proxyctl/internal/app"
|
||||
"proxyctl/internal/profile"
|
||||
"proxyctl/internal/tui"
|
||||
)
|
||||
|
||||
func main() {
|
||||
if err := run(os.Args[1:], os.Stdin, os.Stdout); err != nil {
|
||||
fmt.Fprintln(os.Stderr, "proxyctl:", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
func run(args []string, input io.Reader, output io.Writer) error {
|
||||
if len(args) != 0 {
|
||||
return fmt.Errorf("this build supports no command-line arguments")
|
||||
}
|
||||
path, err := profile.ConfigPath()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
application, err := app.New(profile.NewFileStore(path))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
program := tea.NewProgram(tui.NewModel(application), tea.WithInput(input), tea.WithOutput(output))
|
||||
_, err = program.Run()
|
||||
return err
|
||||
}
|
||||
Reference in New Issue
Block a user