-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c0794f7
commit cf6ac7a
Showing
10 changed files
with
278 additions
and
6 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,25 @@ | ||
#!/bin/bash | ||
|
||
# CLI Build | ||
rm -rf runtipi-cli-go | ||
rm -rf runtipi-cli-go.bak | ||
|
||
# CLI Created Files | ||
rm -rf apps | ||
rm -rf data | ||
rm -rf app-data | ||
rm -rf state | ||
rm -rf repos | ||
rm -rf media | ||
rm -rf traefik | ||
rm -rf user-config | ||
rm -rf backups | ||
rm -rf logs | ||
rm -rf docker-compose.yml | ||
rm -rf VERSION | ||
rm -rf .env | ||
|
||
# Test Files | ||
# /internal/constants/assets/RUNTIPI_VERSION | ||
# /internal/constants/assets/CLI_VERSION | ||
# /.env.local |
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,40 @@ | ||
package subcommands | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
"time" | ||
|
||
"github.com/spf13/cobra" | ||
"github.com/steveiliop56/runtipi-cli-go/internal/api" | ||
"github.com/steveiliop56/runtipi-cli-go/internal/spinner" | ||
) | ||
|
||
var ResetAppCmd = &cobra.Command{ | ||
Use: "reset [app]", | ||
Short: "Resets an app using the Runtipi API", | ||
Long: "This command resets the specified app using the Runtipi worker API", | ||
Args: cobra.MinimumNArgs(1), | ||
Run: func(cmd *cobra.Command, args []string) { | ||
// Define Path | ||
path := fmt.Sprintf("apps/%s/reset", args[0]) | ||
|
||
// Start Spinner | ||
spinner.SetMessage("Resetting app") | ||
spinner.Start() | ||
|
||
// Reset app | ||
err := api.ApiRequest(path, "POST", 5 * time.Minute) | ||
|
||
if err != nil { | ||
spinner.Fail("Failed to reset app") | ||
spinner.Stop() | ||
fmt.Printf("Error: %s\n", err) | ||
os.Exit(1) | ||
} | ||
|
||
// Succeed | ||
spinner.Succeed("App reset succeessfully") | ||
spinner.Stop() | ||
}, | ||
} |
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,40 @@ | ||
package subcommands | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
"time" | ||
|
||
"github.com/spf13/cobra" | ||
"github.com/steveiliop56/runtipi-cli-go/internal/api" | ||
"github.com/steveiliop56/runtipi-cli-go/internal/spinner" | ||
) | ||
|
||
var RestartAppCmd = &cobra.Command{ | ||
Use: "restart [app]", | ||
Short: "Restart an app using the Runtipi API", | ||
Long: "This command restarts the specified app using the Runtipi worker API", | ||
Args: cobra.MinimumNArgs(1), | ||
Run: func(cmd *cobra.Command, args []string) { | ||
// Define Path | ||
path := fmt.Sprintf("apps/%s/restart", args[0]) | ||
|
||
// Start Spinner | ||
spinner.SetMessage("Restarting app") | ||
spinner.Start() | ||
|
||
// Restart app | ||
err := api.ApiRequest(path, "POST", 5 * time.Minute) | ||
|
||
if err != nil { | ||
spinner.Fail("Failed to restart app") | ||
spinner.Stop() | ||
fmt.Printf("Error: %s\n", err) | ||
os.Exit(1) | ||
} | ||
|
||
// Succeed | ||
spinner.Succeed("App restarted succeessfully") | ||
spinner.Stop() | ||
}, | ||
} |
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,40 @@ | ||
package subcommands | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
"time" | ||
|
||
"github.com/spf13/cobra" | ||
"github.com/steveiliop56/runtipi-cli-go/internal/api" | ||
"github.com/steveiliop56/runtipi-cli-go/internal/spinner" | ||
) | ||
|
||
var StartAllCmd = &cobra.Command{ | ||
Use: "start-all", | ||
Short: "Starts all apps using the Runtipi API", | ||
Long: "This command starts all apps using the Runtipi worker API", | ||
Args: cobra.MinimumNArgs(1), | ||
Run: func(cmd *cobra.Command, args []string) { | ||
// Define Path | ||
path := "apps/start-all" | ||
|
||
// Start Spinner | ||
spinner.SetMessage("Starting apps") | ||
spinner.Start() | ||
|
||
// Start apps | ||
err := api.ApiRequest(path, "POST", 15 * time.Minute) | ||
|
||
if err != nil { | ||
spinner.Fail("Failed to start apps") | ||
spinner.Stop() | ||
fmt.Printf("Error: %s\n", err) | ||
os.Exit(1) | ||
} | ||
|
||
// Succeed | ||
spinner.Succeed("Apps succeessfully") | ||
spinner.Stop() | ||
}, | ||
} |
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,40 @@ | ||
package subcommands | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
"time" | ||
|
||
"github.com/spf13/cobra" | ||
"github.com/steveiliop56/runtipi-cli-go/internal/api" | ||
"github.com/steveiliop56/runtipi-cli-go/internal/spinner" | ||
) | ||
|
||
var StopAppCmd = &cobra.Command{ | ||
Use: "stop [app]", | ||
Short: "Stop an app using the Runtipi API", | ||
Long: "This command stops the specified app using the Runtipi worker API", | ||
Args: cobra.MinimumNArgs(1), | ||
Run: func(cmd *cobra.Command, args []string) { | ||
// Define Path | ||
path := fmt.Sprintf("apps/%s/stop", args[0]) | ||
|
||
// Start Spinner | ||
spinner.SetMessage("Stopping app") | ||
spinner.Start() | ||
|
||
// Stop app | ||
err := api.ApiRequest(path, "POST", 5 * time.Minute) | ||
|
||
if err != nil { | ||
spinner.Fail("Failed to stop app") | ||
spinner.Stop() | ||
fmt.Printf("Error: %s\n", err) | ||
os.Exit(1) | ||
} | ||
|
||
// Succeed | ||
spinner.Succeed("App stopped succeessfully") | ||
spinner.Stop() | ||
}, | ||
} |
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,40 @@ | ||
package subcommands | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
"time" | ||
|
||
"github.com/spf13/cobra" | ||
"github.com/steveiliop56/runtipi-cli-go/internal/api" | ||
"github.com/steveiliop56/runtipi-cli-go/internal/spinner" | ||
) | ||
|
||
var UninstallAppCmd = &cobra.Command{ | ||
Use: "uninstall [app]", | ||
Short: "Uninstalls an app using the Runtipi API", | ||
Long: "This command uninstalls the specified app using the Runtipi worker API", | ||
Args: cobra.MinimumNArgs(1), | ||
Run: func(cmd *cobra.Command, args []string) { | ||
// Define Path | ||
path := fmt.Sprintf("apps/%s/uninstall", args[0]) | ||
|
||
// Start Spinner | ||
spinner.SetMessage("Uninstalling app") | ||
spinner.Start() | ||
|
||
// Uninstall app | ||
err := api.ApiRequest(path, "POST", 5 * time.Minute) | ||
|
||
if err != nil { | ||
spinner.Fail("Failed to uninstall app") | ||
spinner.Stop() | ||
fmt.Printf("Error: %s\n", err) | ||
os.Exit(1) | ||
} | ||
|
||
// Succeed | ||
spinner.Succeed("App uninstalled succeessfully") | ||
spinner.Stop() | ||
}, | ||
} |
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,40 @@ | ||
package subcommands | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
"time" | ||
|
||
"github.com/spf13/cobra" | ||
"github.com/steveiliop56/runtipi-cli-go/internal/api" | ||
"github.com/steveiliop56/runtipi-cli-go/internal/spinner" | ||
) | ||
|
||
var UpdateAppCmd = &cobra.Command{ | ||
Use: "update [app]", | ||
Short: "Update an app using the Runtipi API", | ||
Long: "This command updates the specified app using the Runtipi worker API", | ||
Args: cobra.MinimumNArgs(1), | ||
Run: func(cmd *cobra.Command, args []string) { | ||
// Define Path | ||
path := fmt.Sprintf("apps/%s/update", args[0]) | ||
|
||
// Start Spinner | ||
spinner.SetMessage("Updating app") | ||
spinner.Start() | ||
|
||
// Updating app | ||
err := api.ApiRequest(path, "POST", 15 * time.Minute) | ||
|
||
if err != nil { | ||
spinner.Fail("Failed to update app") | ||
spinner.Stop() | ||
fmt.Printf("Error: %s\n", err) | ||
os.Exit(1) | ||
} | ||
|
||
// Succeed | ||
spinner.Succeed("App updated succeessfully") | ||
spinner.Stop() | ||
}, | ||
} |
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