Skip to content

Commit

Permalink
fix: update code to match new cli-skeleton arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
josegonzalez committed Jan 29, 2024
1 parent 231c26e commit 625c2ce
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package main

import (
"context"
"fmt"
"netrc/commands"
"os"
Expand All @@ -19,10 +20,11 @@ func main() {

// Executes the specified command
func Run(args []string) int {
commandMeta := command.SetupRun(AppName, Version, args)
ctx := context.Background()
commandMeta := command.SetupRun(ctx, AppName, Version, args)
c := cli.NewCLI(AppName, Version)
c.Args = os.Args[1:]
c.Commands = command.Commands(commandMeta, Commands)
c.Commands = command.Commands(ctx, commandMeta, Commands)
exitCode, err := c.Run()
if err != nil {
fmt.Fprintf(os.Stderr, "Error executing CLI: %s\n", err.Error())
Expand All @@ -33,7 +35,7 @@ func Run(args []string) int {
}

// Returns a list of implemented commands
func Commands(meta command.Meta) map[string]cli.CommandFactory {
func Commands(ctx context.Context, meta command.Meta) map[string]cli.CommandFactory {
return map[string]cli.CommandFactory{
"set": func() (cli.Command, error) {
return &commands.SetCommand{Meta: meta}, nil
Expand Down

0 comments on commit 625c2ce

Please sign in to comment.