Skip to content
Merged
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
5 changes: 5 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,11 @@ linters:
disabled: true
- name: unused-parameter
- name: unused-receiver
staticcheck:
checks:
- "all"
- "-SA9003"


exclusions:
presets:
Expand Down
1 change: 1 addition & 0 deletions .idx/dev.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
fzf
util-linux
go
golangci-lint
uv
dos2unix
];
Expand Down
2 changes: 0 additions & 2 deletions cmd/ai/pytorch.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,8 @@ func pytorch(cmd *cobra.Command, _ []string) {
utils.RunCmd(command)
}
if utils.GetBoolFlag(cmd, "config") {
// nothing to configure
}
if utils.GetBoolFlag(cmd, "uninstall") {
// TODO
}
}

Expand Down
5 changes: 1 addition & 4 deletions cmd/bigdata/arrowdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@ func linkArrowDbProfileFromHost() {
dstProfile := filepath.Join(utils.UserHomeDir(), ".arrowdb_profile")
if utils.ExistsFile(srcProfile) {
// inside a Docker container, link profile from host
if utils.ExistsFile(dstProfile) {
utils.RemoveAll(dstProfile)
}
utils.Symlink(srcProfile, dstProfile)
utils.Symlink(srcProfile, dstProfile, false)
}
}

Expand Down
4 changes: 2 additions & 2 deletions cmd/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ import (
)

// Pull data for icon from GitHub into ~/.config/icon-data.
func data(cmd *cobra.Command, args []string) {
func data(cmd *cobra.Command, _ []string) {
dir := "~/.config/icon-data"
if !utils.GetBoolFlag(cmd, "force") && utils.ExistsDir(dir+"/.git") {
fmt.Println("Using existing data in ~/.config/icon-data.")
return
}

utils.BackupDir(dir, "")
utils.Backup(dir, "")
utils.MkdirAll(dir, 0o700)

command := utils.Format(`git clone {gitUrl} {dir} \
Expand Down
4 changes: 2 additions & 2 deletions cmd/dev/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func installGitUi(cmd *cobra.Command) {
}

func linkGitUiFiles(baseDir string) {
utils.SymlinkIntoDir("~/.config/icon-data/git/gitui/key_bindings.ron", filepath.Join(baseDir, "gitui"))
utils.SymlinkIntoDir("~/.config/icon-data/git/gitui/key_bindings.ron", filepath.Join(baseDir, "gitui"), true)
}

func configGitUi(cmd *cobra.Command) {
Expand Down Expand Up @@ -124,7 +124,7 @@ func git(cmd *cobra.Command, args []string) {
}
if utils.GetBoolFlag(cmd, "config") {
network.SshClient(cmd, args)
utils.Symlink("~/.config/icon-data/git/gitconfig", "~/.gitconfig")
utils.Symlink("~/.config/icon-data/git/gitconfig", "~/.gitconfig", true)
configGitProxy(cmd)
configGitUi(cmd)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/dev/golang.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func installGoPls(prefix string) {
}

// Install and configure Golang.
func golang(cmd *cobra.Command, args []string) {
func golang(cmd *cobra.Command, _ []string) {
prefix := utils.GetCommandPrefix(false, map[string]uint32{
"/usr/local/go": unix.W_OK | unix.R_OK,
"/usr/local": unix.W_OK | unix.R_OK,
Expand Down
2 changes: 1 addition & 1 deletion cmd/dev/pytype.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
)

// Install and configure pytype.
func pytype(cmd *cobra.Command, args []string) {
func pytype(cmd *cobra.Command, _ []string) {
if utils.GetBoolFlag(cmd, "install") {
command := utils.Format("{pip_install} pytype", map[string]string{
"pip_install": utils.BuildPipInstall(cmd),
Expand Down
2 changes: 1 addition & 1 deletion cmd/dev/rust.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ func installCargoBinstall() {
}

// Install and configure Rust.
func rust(cmd *cobra.Command, args []string) {
func rust(cmd *cobra.Command, _ []string) {
rustupHome := utils.GetStringFlag(cmd, "rustup-home")
if rustupHome == "" {
rustupHome = filepath.Join(utils.UserHomeDir(), ".rustup")
Expand Down
5 changes: 2 additions & 3 deletions cmd/ide/neovim.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
)

// Install and configure neovim.
func neovim(cmd *cobra.Command, args []string) {
func neovim(cmd *cobra.Command, _ []string) {
Neovim(
utils.GetBoolFlag(cmd, "install"),
utils.GetBoolFlag(cmd, "config"),
Expand Down Expand Up @@ -58,8 +58,7 @@ func Neovim(install bool, config bool, uninstall bool, yes_s string) {
}
if config {
dir := "~/.config/nvim"
utils.BackupDir(dir, "")
utils.Symlink("~/.config/icon-data/nvim", dir)
utils.Symlink("~/.config/icon-data/nvim", dir, true)
}
if uninstall {
switch runtime.GOOS {
Expand Down
4 changes: 2 additions & 2 deletions cmd/ide/vscode.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
)

// Install and configure Visual Studio Code.
func vscode(cmd *cobra.Command, args []string) {
func vscode(cmd *cobra.Command, _ []string) {
if utils.GetBoolFlag(cmd, "install") {
switch runtime.GOOS {
case "linux":
Expand Down Expand Up @@ -52,7 +52,7 @@ func vscode(cmd *cobra.Command, args []string) {
if utils.GetBoolFlag(cmd, "copy") {
utils.CopyFileToDir("~/.config/icon-data/vscode/settings.json", userDir)
} else {
utils.SymlinkIntoDir("~/.config/icon-data/vscode/settings.json", userDir)
utils.SymlinkIntoDir("~/.config/icon-data/vscode/settings.json", userDir, true)
}
}
if utils.GetBoolFlag(cmd, "uninstall") {
Expand Down
2 changes: 1 addition & 1 deletion cmd/jupyter/ganymede.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
)

// Install and configure Ganymede.
func ganymede(cmd *cobra.Command, args []string) {
func ganymede(cmd *cobra.Command, _ []string) {
if utils.GetBoolFlag(cmd, "install") {
tmpdir := utils.CreateTempDir("")
defer os.RemoveAll(tmpdir)
Expand Down
6 changes: 3 additions & 3 deletions cmd/jupyter/ipython.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
)

// Install and configure IPython.
func ipython(cmd *cobra.Command, args []string) {
func ipython(cmd *cobra.Command, _ []string) {
if utils.GetBoolFlag(cmd, "install") {
command := utils.Format("{prefix} {pip_install} ipython", map[string]string{
"prefix": utils.GetCommandPrefix(
Expand All @@ -24,10 +24,10 @@ func ipython(cmd *cobra.Command, args []string) {
profile_default := filepath.Join(profile_dir, "profile_default")
utils.Symlink(
"~/.config/icon-data/ipython/startup.ipy",
filepath.Join(profile_default, "startup/startup.ipy"))
filepath.Join(profile_default, "startup/startup.ipy"), true)
utils.SymlinkIntoDir(
"~/.config/icon-data/ipython/ipython_config.py",
profile_default)
profile_default, true)
}
if utils.GetBoolFlag(cmd, "uninstall") {
command := utils.Format("{prefix} {pip_uninstall} ipython", map[string]string{
Expand Down
2 changes: 1 addition & 1 deletion cmd/jupyter/jupyter_book.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
)

// Install and configure jupyter_book.
func jupyter_book(cmd *cobra.Command, args []string) {
func jupyter_book(cmd *cobra.Command, _ []string) {
if utils.GetBoolFlag(cmd, "install") {
command := utils.Format("{pip_install} jupyter-book", map[string]string{
"pip_install": utils.BuildPipInstall(cmd),
Expand Down
2 changes: 1 addition & 1 deletion cmd/jupyter/jupyterlab_vim.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
)

// Install and configure the jupyterlab_vim extension for JupyterLab.
func jupyterlab_vim(cmd *cobra.Command, args []string) {
func jupyterlab_vim(cmd *cobra.Command, _ []string) {
prefix := utils.GetCommandPrefix(
utils.GetBoolFlag(cmd, "sudo"),
map[string]uint32{},
Expand Down
2 changes: 1 addition & 1 deletion cmd/network/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func GetLatestRelease(releaseUrl string) ReleaseInfo {
// Download a release from GitHub.
// @param args: The arguments to parse.
// If None, the arguments from command-line are parsed.
func DownloadGitHubReleaseArgs(cmd *cobra.Command, args []string) {
func DownloadGitHubReleaseArgs(cmd *cobra.Command, _ []string) {
DownloadGitHubRelease(
utils.GetStringFlag(cmd, "repo"),
utils.GetStringFlag(cmd, "version"),
Expand Down
4 changes: 2 additions & 2 deletions cmd/network/ssh_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ func adjustPathInConfig() {
}

// Install and configure SSH client.
func SshClient(cmd *cobra.Command, args []string) {
func SshClient(cmd *cobra.Command, _ []string) {
if utils.GetBoolFlag(cmd, "install") {
}
if utils.GetBoolFlag(cmd, "config") {
utils.SymlinkIntoDir("~/.config/icon-data/ssh/client/config", sshHome)
utils.SymlinkIntoDir("~/.config/icon-data/ssh/client/config", sshHome, true)
copySshcSettingsFromHost()
utils.MkdirAll(filepath.Join(sshHome, "control"), 0o700)
/*
Expand Down
2 changes: 1 addition & 1 deletion cmd/network/ssh_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
)

// Install and configure SSH server.
func SshServer(cmd *cobra.Command, args []string) {
func SshServer(cmd *cobra.Command, _ []string) {
if utils.GetBoolFlag(cmd, "install") {
if utils.IsDebianUbuntuSeries() {
command := utils.Format("{prefix} apt-get update && {prefix} apt-get install {yes_s} openssh-server fail2ban", map[string]string{
Expand Down
2 changes: 1 addition & 1 deletion cmd/shell/alacritty.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
)

// Install and configure the Alacritty terminal.
func alacritty(cmd *cobra.Command, args []string) {
func alacritty(cmd *cobra.Command, _ []string) {
if utils.GetBoolFlag(cmd, "install") {
switch runtime.GOOS {
case "linux":
Expand Down
2 changes: 1 addition & 1 deletion cmd/shell/atuin.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
)

// Install atuin.
func atuin(cmd *cobra.Command, args []string) {
func atuin(cmd *cobra.Command, _ []string) {
if utils.GetBoolFlag(cmd, "install") {
command := "bash <(curl https://raw.githubusercontent.com/ellie/atuin/main/install.sh)"
utils.RunCmd(command)
Expand Down
4 changes: 2 additions & 2 deletions cmd/shell/bash_it.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

// Install bash-it, a community Bash framework.
// For more details, please refer to https://github.com/Bash-it/bash-it#installation.
func bashIt(cmd *cobra.Command, args []string) {
func bashIt(cmd *cobra.Command, _ []string) {
home := utils.UserHomeDir()
if utils.GetBoolFlag(cmd, "install") {
dir := filepath.Join(home, ".bash_it")
Expand All @@ -23,7 +23,7 @@ func bashIt(cmd *cobra.Command, args []string) {
}
if utils.GetBoolFlag(cmd, "config") {
utils.ConfigBash()
utils.Symlink("~/.config/icon-data/bash-it", "~/.bash_it")
utils.Symlink("~/.config/icon-data/bash-it", "~/.bash_it", true)
}
if utils.GetBoolFlag(cmd, "uninstall") {
utils.RunCmd("~/.bash_it/uninstall.sh && rm -rf ~/.bash_it/")
Expand Down
5 changes: 2 additions & 3 deletions cmd/shell/fish.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func generateCrazyCompletions() {
}

// Install and config the fish shell.
func fish(cmd *cobra.Command, args []string) {
func fish(cmd *cobra.Command, _ []string) {
if utils.GetBoolFlag(cmd, "install") {
switch runtime.GOOS {
case "linux":
Expand All @@ -92,8 +92,7 @@ func fish(cmd *cobra.Command, args []string) {
}
if utils.GetBoolFlag(cmd, "config") {
dir := "~/.config/fish"
utils.BackupDir(dir, "")
utils.Symlink("~/.config/icon-data/fish", dir)
utils.Symlink("~/.config/icon-data/fish", dir, true)

generateCompletions()
generateCrazyCompletions()
Expand Down
2 changes: 1 addition & 1 deletion cmd/shell/hyper.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func hyper(cmd *cobra.Command, _ []string) {
log.Printf("Hyper plugins hypercwd, hyper-search, hyper-pane and hyperpower are installed.\n")
utils.Symlink(
"~/.config/icon-data/hyper/hyper.js",
"~/.hyper.js")
"~/.hyper.js", true)
}
if utils.GetBoolFlag(cmd, "uninstall") {
switch runtime.GOOS {
Expand Down
4 changes: 2 additions & 2 deletions cmd/shell/zellij.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
)

// Install and configure Ganymede.
func zellij(cmd *cobra.Command, args []string) {
func zellij(cmd *cobra.Command, _ []string) {
if utils.GetBoolFlag(cmd, "install") {
tmpdir := utils.CreateTempDir("")
defer os.RemoveAll(tmpdir)
Expand All @@ -34,7 +34,7 @@ func zellij(cmd *cobra.Command, args []string) {
utils.RunCmd(command)
}
if utils.GetBoolFlag(cmd, "config") {
utils.Symlink("~/.config/icon-data/zellij/config.kdl", "~/.config/zellij/config.kdl")
utils.Symlink("~/.config/icon-data/zellij/config.kdl", "~/.config/zellij/config.kdl", true)
}
if utils.GetBoolFlag(cmd, "uninstall") {
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
)

// Update icon.
func update(cmd *cobra.Command, args []string) {
func update(cmd *cobra.Command, _ []string) {
dir := utils.GetStringFlag(cmd, "install-dir")
command := utils.Format(`curl -sSL https://raw.githubusercontent.com/legendu-net/icon/main/install_icon.sh \
| {prefix} bash -s -- -d {dir}`, map[string]string{
Expand Down
4 changes: 2 additions & 2 deletions cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
)

// Show the version of icon.
func version(_ *cobra.Command, args []string) {
fmt.Println("0.31.2")
func version(_ *cobra.Command, _ []string) {
fmt.Println("0.32.0")
}

var versionCmd = &cobra.Command{
Expand Down
Loading
Loading