-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Ales Verbic <[email protected]>
- Loading branch information
Showing
5 changed files
with
145 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"log/slog" | ||
"os" | ||
|
||
"github.com/blinklabs-io/cardano-up/pkgmgr" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
func downCommand() *cobra.Command { | ||
cmd := &cobra.Command{ | ||
Use: "down", | ||
Short: "Stops all Docker containers", | ||
Long: `Stops all running Docker containers for installed packages in the current context.`, | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
pm, err := pkgmgr.NewDefaultPackageManager() | ||
if err != nil { | ||
slog.Error(fmt.Sprintf("failed to create package manager: %s", err)) | ||
os.Exit(1) | ||
} | ||
if err := pm.Down(); err != nil { | ||
slog.Error(err.Error()) | ||
os.Exit(1) | ||
} | ||
return nil | ||
}, | ||
} | ||
return cmd | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"log/slog" | ||
"os" | ||
|
||
"github.com/blinklabs-io/cardano-up/pkgmgr" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
func upCommand() *cobra.Command { | ||
cmd := &cobra.Command{ | ||
Use: "up", | ||
Short: "Starts all Docker containers", | ||
Long: `Starts all stopped Docker containers for installed packages in the current context.`, | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
pm, err := pkgmgr.NewDefaultPackageManager() | ||
if err != nil { | ||
slog.Error(fmt.Sprintf("failed to create package manager: %s", err)) | ||
os.Exit(1) | ||
} | ||
if err := pm.Up(); err != nil { | ||
slog.Error(err.Error()) | ||
os.Exit(1) | ||
} | ||
return nil | ||
}, | ||
} | ||
return cmd | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters