initial commit
This commit is contained in:
61
cmd/cli/cli.go
Normal file
61
cmd/cli/cli.go
Normal file
@ -0,0 +1,61 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/urfave/cli/v2"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/credentials/insecure"
|
||||
"os"
|
||||
"time"
|
||||
)
|
||||
|
||||
func main() {
|
||||
commands := []*cli.Command{
|
||||
&cli.Command{
|
||||
Name: "start",
|
||||
Aliases: []string{"s"},
|
||||
Usage: "Start the application service",
|
||||
Action: func(c *cli.Context) error {
|
||||
//d := daemon.NewDaemon()
|
||||
//d.Start()
|
||||
return nil
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
app := &cli.App{
|
||||
Name: "ForeverFiles",
|
||||
Usage: "Create backups designed to last forever",
|
||||
Version: "v1.0.0",
|
||||
Description: "ForeverFiles is a system for storing files forever.",
|
||||
Commands: commands,
|
||||
Flags: nil,
|
||||
Authors: []*cli.Author{
|
||||
{
|
||||
Name: "Mason Payne",
|
||||
Email: "mason@masonitestudios.com",
|
||||
},
|
||||
},
|
||||
Copyright: fmt.Sprintf("%v Masonite Studios LLC", time.Now().Year()),
|
||||
UseShortOptionHandling: true,
|
||||
}
|
||||
err := app.Run(os.Args)
|
||||
if err != nil {
|
||||
fmt.Println(fmt.Errorf("error running app | %w", err))
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
func getConn(dialAddr string) (*grpc.ClientConn, error) {
|
||||
conn, err := grpc.DialContext(
|
||||
context.Background(),
|
||||
dialAddr,
|
||||
//grpc.WithBlock(),
|
||||
grpc.WithTransportCredentials(insecure.NewCredentials()),
|
||||
)
|
||||
if err != nil {
|
||||
return &grpc.ClientConn{}, fmt.Errorf("failed to dial server: %w", err)
|
||||
}
|
||||
return conn, nil
|
||||
}
|
Reference in New Issue
Block a user