Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Alohomora, Obscuro, Riddikulus, Silencio, Expecto Patronum ,Reparo Commands #24

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 88 additions & 0 deletions cmd/wand/Alohomora.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
package wand

import (
"bufio"
"fmt"
"os"
"os/exec"
"strings"

"github.com/spf13/cobra"
)

var alohomoraDescription = fmt.Sprintf(`%s

⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣀⣤⣤⣶⣶⣶⣿⣿⣿⣿⣿⣿⣷⣶⣶⣦⣤⣄⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣴⣶⣿⠿⠛⠛⠉⠉⠁⠀⠀⠀⠀⠀⠀⠀⠀⠈⠉⠉⠛⠻⠿⣿⣷⣦⣄⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣤⣶⡿⠟⠋⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠙⠻⣿⣷⣤⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣶⡿⠟⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠻⣿⣷⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⣠⣾⡿⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣴⠖⠛⠛⢿⣷⣶⣄⠀⠀⠀⠙⢿⣷⣄⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⣠⣾⡿⠋⠀⠀⠀⠀⢀⣀⣤⣤⣤⣤⣤⣤⣄⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⣷⡄⠀⠀⢻⣿⣿⣷⠀⠀⠀⠀⠙⢿⣷⡄⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⣴⣿⠟⠀⠀⠀⠀⣠⣾⣿⣿⣿⣿⠟⠛⠛⢿⣿⣿⣿⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠻⠿⠟⠁⠀⠀⢸⣿⣿⣿⠀⠀⠀⠀⠀⠈⠻⣿⣆⠀⠀⠀⠀⠀
⠀⠀⠀⢀⣾⣿⠃⠀⠀⠀⢠⣾⣿⣿⣿⣿⣿⠁⠀⠀⠀⠀⢻⣿⣿⣿⣿⣦⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣼⣿⡿⠋⠀⠀⠀⠀⠀⠀⠀⠘⣿⣧⡀⠀⠀⠀
⠀⠀⢀⣾⡿⠁⠀⠀⠀⢠⣿⣿⣿⣿⣿⣿⡇⠀⠀⠀⠀⠀⠘⣿⣿⣿⣿⣿⣧⠀⠀⠀⠀⠀⠀⠀⠀⠀⠐⠶⠶⣿⣏⣁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⣿⣷⡀⠀⠀
⠀⠀⣾⣿⠃⠀⠀⠀⠀⣿⣿⣿⣿⣿⣿⣿⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⣿⣇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢻⣿⣿⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠘⣿⣧⠀⠀
⠀⣸⣿⠇⠀⠀⠀⠀⢰⣿⣿⣿⣿⣿⣿⣿⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⣿⣿⡀⠀⠀⠀⠀⢀⣤⣤⣄⠀⠀⠀⢸⣿⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠸⣿⡆⠀
⢀⣿⡟⠀⠀⠀⠀⠀⢸⣿⣿⣿⣿⣿⣿⣿⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⠀⠀⣾⣿⣿⣿⠀⠀⠀⣸⣿⣿⣿⠇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢻⣿⠀
⢸⣿⡇⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⣿⣿⡀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⣿⣿⣷⠀⠀⠀⠀⠘⢿⣿⣁⣀⣀⣴⣿⣿⠿⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠸⣿⡇
⣾⣿⠀⠀⠀⠀⠀⠀⠀⠹⣿⣿⣿⣿⣿⣿⡇⠀⠀⠀⠀⠀⢰⣿⣿⣿⣿⣿⣿⣿⣿⠀⠀⠀⠀⠀⠀⠀⠉⠉⠉⠉⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣧
⣿⣿⠀⠀⠀⠀⠀⠀⠀⠀⠹⣿⣿⣿⣿⣿⣿⡄⠀⠀⠀⢀⣿⣿⣿⣿⣿⣿⣿⣿⣿⠀⠀⠀⠀⠰⠶⠶⠶⠶⠶⠶⠶⠶⠶⠶⠶⠆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿
⣿⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠛⢿⣿⣿⣿⣿⣷⣶⣶⡿⠿⣿⣿⣿⣿⣿⣿⣿⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣤⣤⣤⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿
⢿⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠉⠛⠛⠛⠉⠁⠀⠀⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⣼⣿⣿⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⡿
⢸⣿⡆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⣿⣿⠁⠀⠀⠀⠀⠀⠀⠀⢀⣾⣿⣿⣿⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢰⣿⡇
⠈⣿⣧⠀⠀⠀⠀⠀⠀⠀⢀⣠⣴⣶⣶⣦⣄⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⣿⡏⠀⠀⠀⠀⠀⠀⠀⢠⣾⡟⢹⣿⣿⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣼⣿⠁
⠀⢹⣿⡄⠀⠀⠀⠀⠀⠀⣾⣿⣿⣿⣿⣿⣿⡆⠀⠀⠀⠀⢸⣿⣿⣿⣿⣿⡟⠀⠀⠀⠀⠀⠀⠀⣠⣿⡟⠀⢸⣿⣿⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢰⣿⡏⠀
⠀⠀⢿⣿⡀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⣿⣿⠇⠀⠀⠀⠀⣾⣿⣿⣿⣿⠟⠀⠀⠀⠀⠀⠀⠀⣴⣿⠏⠀⠀⢸⣿⣿⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⣿⡿⠀⠀
⠀⠀⠈⢿⣷⡀⠀⠀⠀⠀⢻⣿⣿⣿⣿⠋⠀⠀⠀⠀⢀⣼⣿⣿⣿⡿⠋⠀⠀⠀⠀⠀⠀⠀⢰⣿⣏⣀⣀⣀⣼⣿⣿⣿⣤⣤⡀⠀⠀⠀⠀⠀⠀⠀⢀⣾⡿⠁⠀⠀
⠀⠀⠀⠈⢿⣿⡄⠀⠀⠀⠀⠙⠻⢿⣿⣷⣶⣶⣶⣾⣿⣿⡿⠟⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠉⠉⠉⠉⠉⢻⣿⣿⣿⠋⠉⠁⠀⠀⠀⠀⠀⠀⢠⣿⡿⠁⠀⠀⠀
⠀⠀⠀⠀⠀⠻⣿⣦⠀⠀⠀⠀⠀⠀⠀⠉⠉⠉⠉⠉⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣾⣿⣿⣿⡄⠀⠀⠀⠀⠀⠀⢀⣴⣿⠟⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠙⢿⣷⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠐⠛⠿⠿⠿⠿⠿⠿⠿⠃⠀⠀⠀⣠⣾⡿⠋⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠙⢿⣷⣄⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣾⡿⠋⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⢿⣿⣦⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣴⣿⠿⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠛⢿⣿⣶⣤⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣤⣶⣿⠿⠛⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠙⠻⢿⣿⣶⣦⣤⣀⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⣀⣤⣴⣶⣿⠿⠟⠋⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠙⠛⠻⠿⠿⣿⣿⣿⣿⣿⣿⣿⡿⠿⠿⠟⠛⠋⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀


Alohomora is used to unlock file or directory permissions, making them writable.

Usage:
$ wand alohomora <file_or_directory>

This command will prompt for confirmation before changing permissions.
`, Yellow)

var alohomoraCmd = &cobra.Command{
Use: "alohomora <file_or_directory>",
Short: "Change file or directory permissions to make them writable",
Long: alohomoraDescription,
Args: cobra.ExactArgs(1),
Run: func(cmd *cobra.Command, args []string) {
target := args[0]

// Confirm with the user before changing permissions
fmt.Printf("Are you sure you want to unlock permissions for '%s'? (y/n): ", target)
reader := bufio.NewReader(os.Stdin)
confirmation, _ := reader.ReadString('\n')
confirmation = strings.TrimSpace(confirmation)

if strings.ToLower(confirmation) == "y" {
// Change file/directory permissions to writable using chmod
fmt.Printf("Unlocking permissions for '%s'...\n", target)
err := exec.Command("chmod", "+w", target).Run()

if err != nil {
fmt.Println("Error changing permissions:", err)
} else {
fmt.Println("Permissions changed successfully. The file/directory is now writable.")
}
} else {
fmt.Println("Operation canceled.")
}
},
}

func init() {
// Add the "Alohomora" command to the root command
rootCmd.AddCommand(alohomoraCmd)
}
59 changes: 59 additions & 0 deletions cmd/wand/Obscuro.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package wand

import (
"fmt"
"os/exec"

"github.com/spf13/cobra"
)

var obscuroDescription = fmt.Sprintf(`%s

⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣀⣀⣀⣀⣤⣴⣶⣶⣶⣦⣤⣄⣀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣴⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⣄⡀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣾⣿⣿⣿⣿⣿⣿⣿⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣼⣿⣿⣿⣿⣿⣿⣿⢋⣲⠙⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣇
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢻⣿⣿⣿⣿⣿⣿⠏⡸⢄⠩⢌⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⣿⣿⡟⣠⣷⣾⣶⣬⡆⢻⣿⡿⢠⠹⢿⣿⣿⣏⣻⣿⣿⣿⣿⣿⣿⣿
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⡿⢟⡶⢋⢔⣦⣌⠝⣯⠰⡉⢆⠡⣺⡿⢛⠛⡻⢧⡻⣿⣿⣿⣿⡟⠟
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢹⣿⣟⢻⣇⠊⢿⣿⡿⠨⢼⣧⣼⣤⣳⡏⢄⣿⣿⣦⢃⢻⡉⣿⣿⣿⠇⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⢯⣿⡘⣯⡰⢈⠭⡑⢂⡾⢩⠉⠭⣹⡇⠜⡻⠿⡋⠌⣼⠷⣿⣿⠋⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⣿⣿⣿⣿⣿⣿⣷⣬⡛⠾⠶⡞⢫⠑⢦⣉⣒⢄⠻⣦⣑⣌⣰⡽⢋⣴⣿⠞⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢹⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⣧⣦⣍⣢⣩⣁⣎⣰⣠⣉⣭⣵⡾⠟⠉⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣯⣍⠉⠉⠁⠀⠀⠀⠀⠀⠀⣀⣀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢿⣿⣿⣿⣿⣿⣦⣤⣶⣶⣶⣿⣿⣿⣿⣿⠁
⠀⠀⠀⠀⢀⣀⣤⣤⣴⣦⣤⣤⣄⣀⡀⠀⢀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣋⡿⠟⠛⠛⠉⠉⠉⠀⠀⠀
⠀⠀⣴⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠛⠉⠉⠁⠀⠀⠉⠉⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⣘⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠛⠻⣿⣿⣿⡿⠟⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠻⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠃⠀⠀⠀⠀⠀⠀⠘⠻⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠘⠿⠿⣿⣿⣿⣿⣿⡿⠿⠛⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀


Obscuro causes a blindfold to appear, concealing vision by clearing the terminal history.

%sWarning: This will remove all command history from the current session.%s
`, Yellow, Red, Reset)

var obscuroCmd = &cobra.Command{
Use: "obscuro",
Short: "Clear terminal history",
Long: obscuroDescription,
Run: func(cmd *cobra.Command, args []string) {
fmt.Println("Clearing terminal history...")

// Run the history -c command to clear the terminal history
err := exec.Command("bash", "-c", "history -c").Run()
if err != nil {
fmt.Println("Error clearing history:", err)
} else {
fmt.Println("History cleared successfully.")
}
},
}

func init() {
// Add the "Obscuro" command to the root command
rootCmd.AddCommand(obscuroCmd)
}
70 changes: 70 additions & 0 deletions cmd/wand/Riddikulus.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
package wand

import (
"fmt"
"os/exec"

"github.com/spf13/cobra"
)

var riddikulusDescription = fmt.Sprintf(`%s


⢰⣶⣶⠀⠀⠀⢀⣶⣶⠂⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⡆⠀⠀⠀⠀
⢸⣿⣿⡆⠀⠀⣾⣿⣿⠀⠀⠀⠀⠀⢀⣶⠶⣶⠀⢀⡶⠶⣶⠀⢸⡇⠀⢀⣄⡀
⢴⣿⡟⣿⡀⣼⠏⣿⣷⠆⣷⠀⢻⡇⣾⡇⠀⣿⠀⢾⡇⠀⣿⠀⢸⡇⢰⣿⣘⣷
⢸⣿⡇⠘⣿⠏⠀⢿⣿⠀⣿⡀⢸⡇⢸⣇⡠⣿⠀⢸⣇⡠⣿⠀⢸⡇⢸⣿⠀⡀
⢸⣿⠀⠀⠈⠀⠀⢸⣿⠀⠻⡧⢻⡇⠀⠉⠀⣿⠀⠀⠉⠀⣿⠀⢸⡇⠀⠙⠞⠁
⠸⡟⠀⠀⠀⠀⠀⠈⡿⠀⠀⠀⠀⠀⢴⡆⣠⠟⠀⢴⡇⣠⠟⠀⠀⠉⠀⠀⠀⠀
⠀⠃⠀⠀⠀⠀⠀⠀⠃⠀⠀⠀⠀⠀⠈⠋⠀⠀⠀⠈⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀


Riddikulus turns system stats into something humorous. This command will display system stats in a fun way, using tools like cowsay, figlet, and fortune.

You can choose different options for output with the --fun option.

Usage:
$ wand riddikulus [--fun figlet|cowsay|fortune]

`, Yellow)

var funOption string

var riddikulusCmd = &cobra.Command{
Use: "riddikulus",
Short: "Display system stats in a humorous way",
Long: riddikulusDescription,
Run: func(cmd *cobra.Command, args []string) {
var err error

if funOption == "" {
funOption = "cowsay"
}

switch funOption {
case "figlet":
fmt.Println("Displaying system stats with figlet...")
err = exec.Command("figlet", "System Stats").Run()
case "cowsay":
fmt.Println("Displaying system stats with cowsay...")
err = exec.Command("fortune", "|", "cowsay").Run()
case "fortune":
fmt.Println("Displaying system stats with fortune...")
err = exec.Command("fortune").Run()
default:
fmt.Println("Invalid fun option. Use 'figlet', 'cowsay', or 'fortune'.")
}

if err != nil {
fmt.Println("Error displaying humorous output:", err)
} else {
fmt.Println("Humorous system stats displayed successfully.")
}
},
}

func init() {
riddikulusCmd.Flags().StringVarP(&funOption, "fun", "f", "", "Choose your fun output (figlet|cowsay|fortune)")

rootCmd.AddCommand(riddikulusCmd)
}
68 changes: 68 additions & 0 deletions cmd/wand/Silencio.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
package wand

import (
"fmt"
"os/exec"

"github.com/spf13/cobra"
)

var silencioDescription = fmt.Sprintf(`%s


⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠻⣆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢰⡦⠬⠧⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢻⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⢀⣠⣤⣤⣤⣀⠀⠀⠀⠙⠀⠀⠀⠀⢀⣠⣤⣤⣤⣀⠀⠀⠀⠀
⠀⠀⢀⣶⠟⠁⠀⠀⠈⠙⣷⡄⠀⠀⠀⠀⢀⣴⠟⠉⠀⠀⠈⠙⢷⡄⠀⠀
⠀⠀⣾⢣⡗⠀⠀⠀⠀⠀⠘⣷⣴⠾⠷⣶⣼⢧⡗⠀⠀⠀⠀⠀⠈⣿⠀⠀
⠘⠛⣿⢸⡄⠀⠀⠀⠀⠀⠀⣿⠁⠀⠀⠈⣿⡸⡇⠀⠀⠀⠀⠀⠀⣾⠟⠃
⠀⠀⠹⣧⡻⣦⠀⠀⠀⢀⣼⠏⠀⠀⠀⠀⠸⣧⡹⣦⠄⠀⠀⠀⣴⠏⠀⠀
⠀⠀⠀⠈⠻⢶⣦⣤⡶⠟⠉⠀⠀⠀⠀⠀⠀⠈⠻⠷⣦⣤⡶⠟⠋⠀⠀⠀


Silencio is a silencing charm that mutes the system's sound.
You can also unmute the sound using the --unmute flag.

Usage:
$ wand silencio [--unmute]

`, Yellow)

var unmute bool

var silencioCmd = &cobra.Command{
Use: "silencio",
Short: "Mute or unmute the system's sound",
Long: silencioDescription,
Run: func(cmd *cobra.Command, args []string) {
var err error

if unmute {
fmt.Println("Unmuting the system sound...")
err = exec.Command("amixer", "set", "Master", "unmute").Run()
} else {
fmt.Println("Muting the system sound...")
err = exec.Command("amixer", "set", "Master", "mute").Run()
}

if err != nil {
fmt.Println("Error adjusting system sound:", err)
} else {
if unmute {
fmt.Println("Sound unmuted successfully.")
} else {
fmt.Println("Sound muted successfully.")
}
}
},
}

func init() {
// Add the --unmute flag to the silencio command
silencioCmd.Flags().BoolVarP(&unmute, "unmute", "u", false, "Unmute the system sound")

// Add the "Silencio" command to the root command
rootCmd.AddCommand(silencioCmd)
}
Loading