Skip to content

Commit

Permalink
Updating visual CLI for more user friendly experience
Browse files Browse the repository at this point in the history
  • Loading branch information
FlUxIuS committed Jul 31, 2024
1 parent 03d3bbd commit ce711e1
Show file tree
Hide file tree
Showing 16 changed files with 2,169 additions and 286 deletions.
9 changes: 6 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,11 @@ RUN echo apt-fast apt-fast/aptmanager string apt-get | debconf-set-selections
RUN apt-get -y install apt-fast python3-matplotlib

# Installing desktop features for next virtual desktop sessions
#RUN echo apt-fast keyboard-configuration/layout string "English (US)" | debconf-set-selections
#RUN echo apt-fast keyboard-configuration/variant string "English (US)" | debconf-set-selections
#RUN apt-get -y install task-lxqt-desktop
RUN echo apt-fast keyboard-configuration/layout string "English (US)" | debconf-set-selections
RUN echo apt-fast keyboard-configuration/variant string "English (US)" | debconf-set-selections
RUN apt-fast -y install task-lxqt-desktop
RUN apt-fast -y install language-pack-en
RUN update-locale

# Audio part
RUN apt-fast install -y pulseaudio-utils pulseaudio libasound2-dev libavahi-client-dev --no-install-recommends
Expand All @@ -57,6 +59,7 @@ RUN chmod +x entrypoint.sh
# Installing Terminal harnesses
RUN ./entrypoint.sh fzf_soft_install
RUN ./entrypoint.sh zsh_tools_install
COPY config/.zshrc /root/.zshrc
RUN ./entrypoint.sh arsenal_soft_install

# Installing Devices
Expand Down
9 changes: 6 additions & 3 deletions Dockerfiles/SDR/corebuild.docker
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,11 @@ RUN echo apt-fast apt-fast/aptmanager string apt-get | debconf-set-selections
RUN apt-get -y install apt-fast python3-matplotlib

# Installing desktop features for next virtual desktop sessions
#RUN echo apt-fast keyboard-configuration/layout string "English (US)" | debconf-set-selections
#RUN echo apt-fast keyboard-configuration/variant string "English (US)" | debconf-set-selections
#RUN apt-get -y install task-lxqt-desktop
RUN echo apt-fast keyboard-configuration/layout string "English (US)" | debconf-set-selections
RUN echo apt-fast keyboard-configuration/variant string "English (US)" | debconf-set-selections
RUN apt-fast -y install task-lxqt-desktop
RUN apt-fast -y install language-pack-en
RUN update-locale

# Audio part
RUN apt-fast install -y pulseaudio-utils pulseaudio libasound2-dev libavahi-client-dev --no-install-recommends
Expand All @@ -57,6 +59,7 @@ RUN chmod +x entrypoint.sh
# Installing Terminal harnesses
RUN ./entrypoint.sh fzf_soft_install
RUN ./entrypoint.sh zsh_tools_install
COPY config/.zshrc /root/.zshrc
RUN ./entrypoint.sh arsenal_soft_install

# Installing Devices
Expand Down
13 changes: 13 additions & 0 deletions config/.zshrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export ZSH="$HOME/.oh-my-zsh"

ZSH_THEME="xiong-chiamiov"

plugins=(
git
zsh-autosuggestions
zsh-syntax-highlighting
)

source $ZSH/oh-my-zsh.sh

alias a='/opt/arsenal/run'
28 changes: 22 additions & 6 deletions go/rfswift/cli/rfcli.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ var ImageTag string
var ExtraHost string
var UsbDevice string
var PulseServer string
var DockerName string
var DockerNewName string

var rootCmd = &cobra.Command{
Use: "rfswift",
Expand Down Expand Up @@ -58,7 +60,7 @@ var runCmd = &cobra.Command{
if os == "linux" { // use pactl to configure ACLs
rfutils.SetPulseCTL(PulseServer)
}
rfdock.DockerRun()
rfdock.DockerRun(DockerName)
},
}

Expand Down Expand Up @@ -118,12 +120,21 @@ var pullCmd = &cobra.Command{
},
}

var renameCmd = &cobra.Command{
Use: "rename",
var retagCmd = &cobra.Command{
Use: "retag",
Short: "Rename an image",
Long: `Rename an image with another tag`,
Run: func(cmd *cobra.Command, args []string) {
rfdock.DockerRename(ImageRef, ImageTag)
rfdock.DockerTag(ImageRef, ImageTag)
},
}

var renameCmd = &cobra.Command{
Use: "rename",
Short: "Rename a container",
Long: `Rename a container by another name`,
Run: func(cmd *cobra.Command, args []string) {
rfdock.DockerRename(DockerName, DockerNewName)
},
}

Expand Down Expand Up @@ -266,6 +277,7 @@ func init() {
rootCmd.AddCommand(execCmd)
rootCmd.AddCommand(commitCmd)
rootCmd.AddCommand(renameCmd)
rootCmd.AddCommand(retagCmd)
rootCmd.AddCommand(installCmd)
rootCmd.AddCommand(removeCmd)
rootCmd.AddCommand(ImagesCmd)
Expand Down Expand Up @@ -302,8 +314,10 @@ func init() {
installCmd.Flags().StringVarP(&ContID, "container", "c", "", "container to run")

//pullCmd.MarkFlagRequired("tag")
renameCmd.Flags().StringVarP(&ImageRef, "image", "i", "", "image reference")
renameCmd.Flags().StringVarP(&ImageTag, "tag", "t", "", "rename to target tag")
retagCmd.Flags().StringVarP(&ImageRef, "image", "i", "", "image reference")
retagCmd.Flags().StringVarP(&ImageTag, "tag", "t", "", "rename to target tag")
renameCmd.Flags().StringVarP(&DockerName, "name", "n", "", "Docker current name")
renameCmd.Flags().StringVarP(&DockerNewName, "destination", "d", "", "Docker new name")
commitCmd.Flags().StringVarP(&ContID, "container", "c", "", "container to run")
commitCmd.Flags().StringVarP(&DImage, "image", "i", "", "image (default: 'myrfswift:latest')")
commitCmd.MarkFlagRequired("container")
Expand All @@ -318,6 +332,8 @@ func init() {
runCmd.Flags().StringVarP(&ExtraBind, "bind", "b", "", "extra bindings (separate them with commas)")
runCmd.Flags().StringVarP(&DImage, "image", "i", "", "image (default: 'myrfswift:latest')")
runCmd.Flags().StringVarP(&PulseServer, "pulseserver", "p", "tcp:127.0.0.1:34567", "PULSE SERVER TCP address (by default: tcp:127.0.0.1:34567)")
runCmd.Flags().StringVarP(&DockerName, "name", "n", "", "A docker name")
runCmd.MarkFlagRequired("name")
lastCmd.Flags().StringVarP(&FilterLast, "filter", "f", "", "filter by image name")
}

Expand Down
85 changes: 85 additions & 0 deletions go/rfswift/common/common.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
package common

import (
"fmt"
"strings"
)

var Version = "0.4.7"
var Branch = "main"
var ascii_art = `
-%@%- :==-.
:%:*+=:+%. .%@%#%+-:-=%@*
%==#=: . .+# :@%:*==--: . =%.
:@=::+#:. .+-:%. %@:*+==..=**+=-:::=#=
+****=:+. +=::*#-%- .@+:*.:.:=***:.::...:*#*
::%*#*:* :+- *:-.=%**. =@:+*+:.==.:::=:: .-:.:#+
:*%#**%.-%%%+ :#:#+:.=#%%@@*.:==++.=:.-#@@@#:*==+=%
%#@+*: +%##+%@@@%=...==-+= ::%@*#@%#%%%@%=*=*
:*#%#*. .=: **@%%%%#==+=-=+: .+@: %*+%=...*@+@:
+=*+*@: ::. .@*@@@@#*+*##%*::=@* :%*-:-%*. *@:
::.@=@=#= . =@@@@%=*#*%@%===+%@+=*%*:*%=%.--*#-: %*
##@:==%%%@@@@#=#%#*-:-=*%@@@%+:::=%%=#-:-:-@:= .@
.%@. :==@@@%#@@@*=*#===:: .:=+***=+**.::-:-%=+ :@
*@: %%@@@%+=*@@@%%%*====-::. ::=-=:*%=-.@*
.*%%%*=. :@%:. .*%=::*#@@@@%*=::::::::..:*@#-:.%%.
** =%.- . @@ :@%*=:::==+**%%@@@@@@@%*=:..*@*
%: =@: %@: .@+%@%#==--::::----:::.:*@*:=#%@=
-%*%. :@* :. :@. :=%@@%%%#**#%%@@#-:#*: %=
.@= .. #@-**. -@: .#*#%. :%=. :@*
:%. -- =++@@=+*. :%. +**@@%@+-:::* %@@.
%@- -* =%@@@@@@%=**: =% :#@@=%@@@@- .%.%@@*
@@@+.=*:-@@@@%%%@%@%%@#: :#@@=. *#.:-@# *@@@@%
%@%@%=**@@%%%%@@@@@@@*.=@#: .*%:+%*- *@%@@@@@:*=
:@@@@@#@@@@@@@@@@= :*: :*@@= ** *+====-@@@@@#. *=
:@@@@@@@@@@+ .=%@@- -# :#@@@@@@@@--%.
:@@@@@#:.:- .=@@%= .%%%@@@@@@@*: :%@@%.
#@*.:=-:=%@@*...:::::.. .=+***=#@%
-@=--*@@@* :=+#%%#+:: #@@=%:
.@*%@@*. .-+=:.:@@@* -#=.
*@%= .:
:
888~-_ 888~~ ,d88~~\ ,e, 88~\ d8
888 \ 888___ 8888 Y88b e / " _888__ _d88__
888 | 888 'Y88b Y88b d8b / 888 888 888
888 / 888 'Y88b, Y888/Y88b/ 888 888 888
888_-~ 888 8888 Y8/ Y8/ 888 888 888
888 ~-_ 888 \__88P' Y Y 888 888 "88_/
RF toolbox for HAMs and professionals
`

func PrintASCII() {
colors := []string{
"\033[31m", // Red
"\033[33m", // Yellow
"\033[32m", // Green
"\033[36m", // Cyan
"\033[34m", // Blue
"\033[35m", // Magenta
}
reset := "\033[0m"

lines := strings.Split(ascii_art, "\n")
for i, line := range lines {
color := colors[i%len(colors)]
fmt.Println(color + line + reset)
}
}

func PrintErrorMessage(err error) {
red := "\033[31m"
white := "\033[37m"
reset := "\033[0m"
fmt.Printf("%s[!] %s%s%s\n", red, white, err.Error(), reset)
}

func PrintSuccessMessage(message string) {
green := "\033[32m"
white := "\033[37m"
reset := "\033[0m"
fmt.Printf("%s[+] %s%s%s\n", green, white, message, reset)
}
Loading

0 comments on commit ce711e1

Please sign in to comment.