1
0
mirror of https://github.com/coalaura/up.git synced 2025-07-18 21:53:23 +00:00

combine server and client into one binary

This commit is contained in:
Laura
2025-06-21 00:09:08 +02:00
parent 6633087578
commit ce41360604
13 changed files with 94 additions and 75 deletions

View File

@ -1,4 +1,4 @@
package main
package client
import (
"bytes"

View File

@ -1,4 +1,4 @@
package main
package client
import (
"context"
@ -13,40 +13,18 @@ import (
"github.com/urfave/cli/v3"
)
var (
Version = "dev"
var log *logger.Logger
func Before(ctx context.Context, _ *cli.Command) (context.Context, error) {
log = logger.New().DetectTerminal().WithOptions(logger.Options{
NoTime: true,
NoLevel: true,
})
)
func main() {
app := &cli.Command{
Name: "up",
Usage: "up client",
Version: Version,
ArgsUsage: "<file> <host>",
UsageText: "up [options] <file> <host>",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "identity",
Aliases: []string{"i"},
Usage: "private key file for authentication",
},
},
Action: run,
EnableShellCompletion: true,
UseShortOptionHandling: true,
Suggest: true,
}
err := app.Run(context.Background(), os.Args)
log.MustPanic(err)
return ctx, nil
}
func run(_ context.Context, cmd *cli.Command) error {
func Run(_ context.Context, cmd *cli.Command) error {
args := cmd.Args().Slice()
if len(args) != 2 {
return errors.New("Usage: up [options] <file> <host>")

View File

@ -1,4 +1,4 @@
package main
package client
import (
"os"

View File

@ -1,4 +1,4 @@
package main
package client
import (
"os"

View File

@ -1,4 +1,4 @@
package main
package client
import (
"io"

View File

@ -1,4 +1,4 @@
package main
package client
import (
"bytes"