From 5686498442b95efb4c9c149ea5d07da37c5c015b Mon Sep 17 00:00:00 2001 From: Asperatus Date: Mon, 16 May 2022 13:29:57 -0400 Subject: [PATCH 01/16] xdg-ninja: change bat flags for retrocompatibility --- xdg-ninja.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xdg-ninja.sh b/xdg-ninja.sh index 1cf3d71..6044cdf 100755 --- a/xdg-ninja.sh +++ b/xdg-ninja.sh @@ -129,7 +129,7 @@ log() { if $USE_GLOW; then printf "%s\n" "$HELP" | glow - elif $USE_BAT; then - printf "%s\n" "$HELP" | bat -pp -f --language markdown + printf "%s\n" "$HELP" | bat -pp --decorations=always --color=always --language markdown else printf "%s\n" "$HELP" fi -- 2.47.3 From c80f3f88dc3dd768fb690d49a7ec4bfcb7cf4bc0 Mon Sep 17 00:00:00 2001 From: b3nj4m1n Date: Mon, 16 May 2022 20:43:10 +0200 Subject: [PATCH 02/16] Added antidot configs Closes #2 Conversion done using Scr0nch's https://gitlab.com/Scr0nch/antidot-to-xdg-ninja-config-transformer/ --- README.md | 2 +- programs/aria2.json | 13 +++++++++---- programs/bash.json | 10 ++++++++++ programs/ccache.json | 10 ++++++++++ programs/chez.json | 10 ++++++++++ programs/fontconfig.json | 10 ++++++++++ programs/fonts.json | 10 ++++++++++ programs/gdb.json | 10 ++++++++++ programs/gem.json | 20 ++++++++++++++++++++ programs/httpie.json | 10 ++++++++++ programs/less.json | 10 ++++++++++ programs/lnav.json | 10 ++++++++++ programs/mapscii.json | 10 ++++++++++ programs/pex.json | 10 ++++++++++ programs/pylint.json | 10 ++++++++++ programs/qrcp.json | 10 ++++++++++ programs/racket.json | 10 ++++++++++ programs/tig.json | 10 ++++++++++ programs/weechat.json | 10 ++++++++++ programs/xcompose.json | 15 +++++++++++++++ 20 files changed, 205 insertions(+), 5 deletions(-) create mode 100644 programs/bash.json create mode 100644 programs/ccache.json create mode 100644 programs/chez.json create mode 100644 programs/fontconfig.json create mode 100644 programs/fonts.json create mode 100644 programs/gdb.json create mode 100644 programs/gem.json create mode 100644 programs/httpie.json create mode 100644 programs/less.json create mode 100644 programs/lnav.json create mode 100644 programs/mapscii.json create mode 100644 programs/pex.json create mode 100644 programs/pylint.json create mode 100644 programs/qrcp.json create mode 100644 programs/racket.json create mode 100644 programs/tig.json create mode 100644 programs/weechat.json create mode 100644 programs/xcompose.json diff --git a/README.md b/README.md index d97b7e8..7204c1d 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ A shell script which checks your _$HOME_ for unwanted files and directories. When it encounters a file it knows about, it will tell you whether it's possible to move this file to an appropriate location, and how to do it. -Currently, a subset of the [arch wiki page on XDG_BASE_DIR](https://wiki.archlinux.org/title/XDG_Base_Directory) is implemented as configurations. +The configurations are from the [arch wiki page on XDG_BASE_DIR](https://wiki.archlinux.org/title/XDG_Base_Directory), [antidot](https://github.com/doron-cohen/antidot) (thanks to Scr0nch for writing a conversion tool), and contributed by other users. ## Running diff --git a/programs/aria2.json b/programs/aria2.json index 26ad0fe..62751d8 100644 --- a/programs/aria2.json +++ b/programs/aria2.json @@ -1,10 +1,15 @@ { - "name": "aria2", + "name": "aria2_dir", "files": [ { - "path": "$HOME/.aria2", - "movable": true, - "help": "Supported since commit _8bc1d37_.\n\nYou can move the configuration file to _XDG_CONFIG_HOME/aria2/aria2.conf_.\n\nYou can move the cache files to _XDG_CACHE_HOME/aria2_.\n" + "path": "${HOME}/.aria2/dht.dat", + "moveable": true, + "help": "Supported\n\nThe file ${HOME}/.aria2/dht.dat can be moved to ${XDG_CACHE_HOME}/aria2/dht.dat.\n" + }, + { + "path": "${HOME}/.aria2/aria.conf", + "moveable": true, + "help": "Supported\n\nThe file ${HOME}/.aria2/aria.conf can be moved to ${XDG_CONFIG_HOME}/aria2/aria2.conf.\n" } ] } diff --git a/programs/bash.json b/programs/bash.json new file mode 100644 index 0000000..7b8feec --- /dev/null +++ b/programs/bash.json @@ -0,0 +1,10 @@ +{ + "name": "bash", + "files": [ + { + "path": "${HOME}/.bash_history", + "moveable": true, + "help": "Export the following environment variables:\n\n```bash\nexport HISTFILE=${XDG_CACHE_HOME}/bash/history\n```\n" + } + ] +} diff --git a/programs/ccache.json b/programs/ccache.json new file mode 100644 index 0000000..ea23af8 --- /dev/null +++ b/programs/ccache.json @@ -0,0 +1,10 @@ +{ + "name": "ccache", + "files": [ + { + "path": "${HOME}/.ccache", + "moveable": true, + "help": "Export the following environment variables:\n\n```bash\nexport CCACHE_DIR=${XDG_CACHE_HOME}/ccache\n```\n" + } + ] +} diff --git a/programs/chez.json b/programs/chez.json new file mode 100644 index 0000000..722e131 --- /dev/null +++ b/programs/chez.json @@ -0,0 +1,10 @@ +{ + "name": "chez", + "files": [ + { + "path": "${HOME}/.chezscheme_history", + "moveable": true, + "help": "Alias petite to use custom locations:\n\n```bash\nalias petite=petite --eehistory ${XDG_DATA_HOME}/chezscheme/history\nalias scheme=scheme --eehistory ${XDG_DATA_HOME}/chezscheme/history```\n" + } + ] +} diff --git a/programs/fontconfig.json b/programs/fontconfig.json new file mode 100644 index 0000000..396a6f6 --- /dev/null +++ b/programs/fontconfig.json @@ -0,0 +1,10 @@ +{ + "name": "fontconfig", + "files": [ + { + "path": "${HOME}/.fontconfig", + "moveable": true, + "help": "Supported\n\nThe file ${HOME}/.fontconfig can be moved to ${XDG_DATA_HOME}/fontconfig.\n" + } + ] +} diff --git a/programs/fonts.json b/programs/fonts.json new file mode 100644 index 0000000..667f395 --- /dev/null +++ b/programs/fonts.json @@ -0,0 +1,10 @@ +{ + "name": "fonts", + "files": [ + { + "path": "${HOME}/.fonts", + "moveable": true, + "help": "Supported\n\nThe file ${HOME}/.fonts can be moved to ${XDG_DATA_HOME}/fonts.\n" + } + ] +} diff --git a/programs/gdb.json b/programs/gdb.json new file mode 100644 index 0000000..f0898fc --- /dev/null +++ b/programs/gdb.json @@ -0,0 +1,10 @@ +{ + "name": "gdb", + "files": [ + { + "path": "${HOME}/.gdbinit", + "moveable": true, + "help": "Alias gdb to use custom locations:\n\n```bash\nalias gdb=gdb -n -x $XDG_CONFIG_HOME/gdb/init```\n" + } + ] +} diff --git a/programs/gem.json b/programs/gem.json new file mode 100644 index 0000000..d926587 --- /dev/null +++ b/programs/gem.json @@ -0,0 +1,20 @@ +{ + "name": "gem", + "files": [ + { + "path": "${HOME}/.gem/ruby", + "moveable": true, + "help": "Supported\n\nThe file ${HOME}/.gem/ruby can be moved to ${XDG_CONFIG_HOME}/gem.\n" + }, + { + "path": "${HOME}/.gem", + "moveable": true, + "help": "Export the following environment variables:\n\n```bash\nexport GEM_HOME=${XDG_DATA_HOME}/gem\n```\n" + }, + { + "path": "${HOME}/.gem/specs", + "moveable": true, + "help": "Export the following environment variables:\n\n```bash\nexport GEM_SPEC_CACHE=${XDG_CACHE_HOME}/gem\n```\n" + } + ] +} diff --git a/programs/httpie.json b/programs/httpie.json new file mode 100644 index 0000000..2237d48 --- /dev/null +++ b/programs/httpie.json @@ -0,0 +1,10 @@ +{ + "name": "httpie", + "files": [ + { + "path": "${HOME}/.httpie", + "moveable": true, + "help": "Supported\n\nThe file ${HOME}/.httpie can be moved to ${XDG_CONFIG_HOME}/httpie.\n" + } + ] +} diff --git a/programs/less.json b/programs/less.json new file mode 100644 index 0000000..2f0fb8b --- /dev/null +++ b/programs/less.json @@ -0,0 +1,10 @@ +{ + "name": "less", + "files": [ + { + "path": "${HOME}/.lesshst", + "moveable": true, + "help": "Export the following environment variables:\n\n```bash\nexport LESSHISTFILE=${XDG_CACHE_HOME}/less/history\n```\n" + } + ] +} diff --git a/programs/lnav.json b/programs/lnav.json new file mode 100644 index 0000000..404e6ec --- /dev/null +++ b/programs/lnav.json @@ -0,0 +1,10 @@ +{ + "name": "lnav", + "files": [ + { + "path": "${HOME}/.lnav", + "moveable": true, + "help": "Supported\n\nThe file ${HOME}/.lnav can be moved to ${XDG_CONFIG_HOME}/lnav.\n" + } + ] +} diff --git a/programs/mapscii.json b/programs/mapscii.json new file mode 100644 index 0000000..468034d --- /dev/null +++ b/programs/mapscii.json @@ -0,0 +1,10 @@ +{ + "name": "mapscii", + "files": [ + { + "path": "${HOME}/.mapscii", + "moveable": true, + "help": "Supported\n\nThe file ${HOME}/.mapscii can be moved to ${XDG_CACHE_HOME}/mapscii.\n" + } + ] +} diff --git a/programs/pex.json b/programs/pex.json new file mode 100644 index 0000000..69bb3be --- /dev/null +++ b/programs/pex.json @@ -0,0 +1,10 @@ +{ + "name": "pex", + "files": [ + { + "path": "${HOME}/.pex", + "moveable": true, + "help": "Export the following environment variables:\n\n```bash\nexport PEX_ROOT=${XDG_CACHE_HOME}/pex\n```\n" + } + ] +} diff --git a/programs/pylint.json b/programs/pylint.json new file mode 100644 index 0000000..7f196d3 --- /dev/null +++ b/programs/pylint.json @@ -0,0 +1,10 @@ +{ + "name": "pylint", + "files": [ + { + "path": "${HOME}/.pylint.d", + "moveable": true, + "help": "Export the following environment variables:\n\n```bash\nexport PYLINTHOME=${XDG_CACHE_HOME}/pylint\n```\n" + } + ] +} diff --git a/programs/qrcp.json b/programs/qrcp.json new file mode 100644 index 0000000..ea76ddf --- /dev/null +++ b/programs/qrcp.json @@ -0,0 +1,10 @@ +{ + "name": "qrcp", + "files": [ + { + "path": "${HOME}/.qrcp", + "moveable": true, + "help": "Supported\n\nThe file ${HOME}/.qrcp can be moved to ${XDG_CONFIG_HOME}/qrcp/config.json.\n" + } + ] +} diff --git a/programs/racket.json b/programs/racket.json new file mode 100644 index 0000000..430389f --- /dev/null +++ b/programs/racket.json @@ -0,0 +1,10 @@ +{ + "name": "racket", + "files": [ + { + "path": "${HOME}/.racket", + "moveable": true, + "help": "Supported\n\nThe file ${HOME}/.racket can be moved to ${XDG_CONFIG_HOME}/racket.\n" + } + ] +} diff --git a/programs/tig.json b/programs/tig.json new file mode 100644 index 0000000..0d54273 --- /dev/null +++ b/programs/tig.json @@ -0,0 +1,10 @@ +{ + "name": "tig", + "files": [ + { + "path": "${HOME}/.tig_history", + "moveable": true, + "help": "Supported\n\nThe file ${HOME}/.tig_history can be moved to ${XDG_DATA_HOME}/tig/history.\n" + } + ] +} diff --git a/programs/weechat.json b/programs/weechat.json new file mode 100644 index 0000000..d50e22e --- /dev/null +++ b/programs/weechat.json @@ -0,0 +1,10 @@ +{ + "name": "weechat", + "files": [ + { + "path": "${HOME}/.weechat", + "moveable": true, + "help": "Export the following environment variables:\n\n```bash\nexport WEECHAT_HOME=${XDG_CONFIG_HOME}/weechat\n```\nAlias weechat to use custom locations:\n\n```bash\nalias weechat=weechat -d ${XDG_CONFIG_HOME}/weechat```\n" + } + ] +} diff --git a/programs/xcompose.json b/programs/xcompose.json new file mode 100644 index 0000000..36d6b28 --- /dev/null +++ b/programs/xcompose.json @@ -0,0 +1,15 @@ +{ + "name": "xcompose", + "files": [ + { + "path": "${HOME}/.XCompose", + "moveable": true, + "help": "Export the following environment variables:\n\n```bash\nexport XCOMPOSEFILE=${XDG_CONFIG_HOME}/X11/xcompose\n```\n" + }, + { + "path": "${HOME}/.compose-cache", + "moveable": true, + "help": "Export the following environment variables:\n\n```bash\nexport XCOMPOSECACHE=${XDG_CACHE_HOME}/X11/xcompose\n```\n" + } + ] +} -- 2.47.3 From ac241ce7615d5323603d7e5adbd71ec20f780ebd Mon Sep 17 00:00:00 2001 From: Sebastian Willenbrink Date: Mon, 16 May 2022 23:42:41 +0200 Subject: [PATCH 03/16] Fix typo: moveable to movable --- programs/aria2.json | 4 ++-- programs/bash.json | 2 +- programs/ccache.json | 2 +- programs/chez.json | 2 +- programs/fontconfig.json | 2 +- programs/fonts.json | 2 +- programs/gdb.json | 2 +- programs/gem.json | 6 +++--- programs/httpie.json | 2 +- programs/less.json | 2 +- programs/lnav.json | 2 +- programs/mapscii.json | 2 +- programs/pex.json | 2 +- programs/pylint.json | 2 +- programs/qrcp.json | 2 +- programs/racket.json | 2 +- programs/tig.json | 2 +- programs/weechat.json | 2 +- programs/xcompose.json | 4 ++-- 19 files changed, 23 insertions(+), 23 deletions(-) diff --git a/programs/aria2.json b/programs/aria2.json index 62751d8..0d4d127 100644 --- a/programs/aria2.json +++ b/programs/aria2.json @@ -3,12 +3,12 @@ "files": [ { "path": "${HOME}/.aria2/dht.dat", - "moveable": true, + "movable": true, "help": "Supported\n\nThe file ${HOME}/.aria2/dht.dat can be moved to ${XDG_CACHE_HOME}/aria2/dht.dat.\n" }, { "path": "${HOME}/.aria2/aria.conf", - "moveable": true, + "movable": true, "help": "Supported\n\nThe file ${HOME}/.aria2/aria.conf can be moved to ${XDG_CONFIG_HOME}/aria2/aria2.conf.\n" } ] diff --git a/programs/bash.json b/programs/bash.json index 7b8feec..9f028da 100644 --- a/programs/bash.json +++ b/programs/bash.json @@ -3,7 +3,7 @@ "files": [ { "path": "${HOME}/.bash_history", - "moveable": true, + "movable": true, "help": "Export the following environment variables:\n\n```bash\nexport HISTFILE=${XDG_CACHE_HOME}/bash/history\n```\n" } ] diff --git a/programs/ccache.json b/programs/ccache.json index ea23af8..849449b 100644 --- a/programs/ccache.json +++ b/programs/ccache.json @@ -3,7 +3,7 @@ "files": [ { "path": "${HOME}/.ccache", - "moveable": true, + "movable": true, "help": "Export the following environment variables:\n\n```bash\nexport CCACHE_DIR=${XDG_CACHE_HOME}/ccache\n```\n" } ] diff --git a/programs/chez.json b/programs/chez.json index 722e131..87325cb 100644 --- a/programs/chez.json +++ b/programs/chez.json @@ -3,7 +3,7 @@ "files": [ { "path": "${HOME}/.chezscheme_history", - "moveable": true, + "movable": true, "help": "Alias petite to use custom locations:\n\n```bash\nalias petite=petite --eehistory ${XDG_DATA_HOME}/chezscheme/history\nalias scheme=scheme --eehistory ${XDG_DATA_HOME}/chezscheme/history```\n" } ] diff --git a/programs/fontconfig.json b/programs/fontconfig.json index 396a6f6..db9f988 100644 --- a/programs/fontconfig.json +++ b/programs/fontconfig.json @@ -3,7 +3,7 @@ "files": [ { "path": "${HOME}/.fontconfig", - "moveable": true, + "movable": true, "help": "Supported\n\nThe file ${HOME}/.fontconfig can be moved to ${XDG_DATA_HOME}/fontconfig.\n" } ] diff --git a/programs/fonts.json b/programs/fonts.json index 667f395..0fd2a9a 100644 --- a/programs/fonts.json +++ b/programs/fonts.json @@ -3,7 +3,7 @@ "files": [ { "path": "${HOME}/.fonts", - "moveable": true, + "movable": true, "help": "Supported\n\nThe file ${HOME}/.fonts can be moved to ${XDG_DATA_HOME}/fonts.\n" } ] diff --git a/programs/gdb.json b/programs/gdb.json index f0898fc..5c579c2 100644 --- a/programs/gdb.json +++ b/programs/gdb.json @@ -3,7 +3,7 @@ "files": [ { "path": "${HOME}/.gdbinit", - "moveable": true, + "movable": true, "help": "Alias gdb to use custom locations:\n\n```bash\nalias gdb=gdb -n -x $XDG_CONFIG_HOME/gdb/init```\n" } ] diff --git a/programs/gem.json b/programs/gem.json index d926587..1d83483 100644 --- a/programs/gem.json +++ b/programs/gem.json @@ -3,17 +3,17 @@ "files": [ { "path": "${HOME}/.gem/ruby", - "moveable": true, + "movable": true, "help": "Supported\n\nThe file ${HOME}/.gem/ruby can be moved to ${XDG_CONFIG_HOME}/gem.\n" }, { "path": "${HOME}/.gem", - "moveable": true, + "movable": true, "help": "Export the following environment variables:\n\n```bash\nexport GEM_HOME=${XDG_DATA_HOME}/gem\n```\n" }, { "path": "${HOME}/.gem/specs", - "moveable": true, + "movable": true, "help": "Export the following environment variables:\n\n```bash\nexport GEM_SPEC_CACHE=${XDG_CACHE_HOME}/gem\n```\n" } ] diff --git a/programs/httpie.json b/programs/httpie.json index 2237d48..e3c200e 100644 --- a/programs/httpie.json +++ b/programs/httpie.json @@ -3,7 +3,7 @@ "files": [ { "path": "${HOME}/.httpie", - "moveable": true, + "movable": true, "help": "Supported\n\nThe file ${HOME}/.httpie can be moved to ${XDG_CONFIG_HOME}/httpie.\n" } ] diff --git a/programs/less.json b/programs/less.json index 2f0fb8b..4c073d4 100644 --- a/programs/less.json +++ b/programs/less.json @@ -3,7 +3,7 @@ "files": [ { "path": "${HOME}/.lesshst", - "moveable": true, + "movable": true, "help": "Export the following environment variables:\n\n```bash\nexport LESSHISTFILE=${XDG_CACHE_HOME}/less/history\n```\n" } ] diff --git a/programs/lnav.json b/programs/lnav.json index 404e6ec..bb0013f 100644 --- a/programs/lnav.json +++ b/programs/lnav.json @@ -3,7 +3,7 @@ "files": [ { "path": "${HOME}/.lnav", - "moveable": true, + "movable": true, "help": "Supported\n\nThe file ${HOME}/.lnav can be moved to ${XDG_CONFIG_HOME}/lnav.\n" } ] diff --git a/programs/mapscii.json b/programs/mapscii.json index 468034d..f9b69bd 100644 --- a/programs/mapscii.json +++ b/programs/mapscii.json @@ -3,7 +3,7 @@ "files": [ { "path": "${HOME}/.mapscii", - "moveable": true, + "movable": true, "help": "Supported\n\nThe file ${HOME}/.mapscii can be moved to ${XDG_CACHE_HOME}/mapscii.\n" } ] diff --git a/programs/pex.json b/programs/pex.json index 69bb3be..7794b4c 100644 --- a/programs/pex.json +++ b/programs/pex.json @@ -3,7 +3,7 @@ "files": [ { "path": "${HOME}/.pex", - "moveable": true, + "movable": true, "help": "Export the following environment variables:\n\n```bash\nexport PEX_ROOT=${XDG_CACHE_HOME}/pex\n```\n" } ] diff --git a/programs/pylint.json b/programs/pylint.json index 7f196d3..3e157fd 100644 --- a/programs/pylint.json +++ b/programs/pylint.json @@ -3,7 +3,7 @@ "files": [ { "path": "${HOME}/.pylint.d", - "moveable": true, + "movable": true, "help": "Export the following environment variables:\n\n```bash\nexport PYLINTHOME=${XDG_CACHE_HOME}/pylint\n```\n" } ] diff --git a/programs/qrcp.json b/programs/qrcp.json index ea76ddf..4d212d7 100644 --- a/programs/qrcp.json +++ b/programs/qrcp.json @@ -3,7 +3,7 @@ "files": [ { "path": "${HOME}/.qrcp", - "moveable": true, + "movable": true, "help": "Supported\n\nThe file ${HOME}/.qrcp can be moved to ${XDG_CONFIG_HOME}/qrcp/config.json.\n" } ] diff --git a/programs/racket.json b/programs/racket.json index 430389f..71bdf71 100644 --- a/programs/racket.json +++ b/programs/racket.json @@ -3,7 +3,7 @@ "files": [ { "path": "${HOME}/.racket", - "moveable": true, + "movable": true, "help": "Supported\n\nThe file ${HOME}/.racket can be moved to ${XDG_CONFIG_HOME}/racket.\n" } ] diff --git a/programs/tig.json b/programs/tig.json index 0d54273..6e7b38b 100644 --- a/programs/tig.json +++ b/programs/tig.json @@ -3,7 +3,7 @@ "files": [ { "path": "${HOME}/.tig_history", - "moveable": true, + "movable": true, "help": "Supported\n\nThe file ${HOME}/.tig_history can be moved to ${XDG_DATA_HOME}/tig/history.\n" } ] diff --git a/programs/weechat.json b/programs/weechat.json index d50e22e..3b4eb80 100644 --- a/programs/weechat.json +++ b/programs/weechat.json @@ -3,7 +3,7 @@ "files": [ { "path": "${HOME}/.weechat", - "moveable": true, + "movable": true, "help": "Export the following environment variables:\n\n```bash\nexport WEECHAT_HOME=${XDG_CONFIG_HOME}/weechat\n```\nAlias weechat to use custom locations:\n\n```bash\nalias weechat=weechat -d ${XDG_CONFIG_HOME}/weechat```\n" } ] diff --git a/programs/xcompose.json b/programs/xcompose.json index 36d6b28..659a33a 100644 --- a/programs/xcompose.json +++ b/programs/xcompose.json @@ -3,12 +3,12 @@ "files": [ { "path": "${HOME}/.XCompose", - "moveable": true, + "movable": true, "help": "Export the following environment variables:\n\n```bash\nexport XCOMPOSEFILE=${XDG_CONFIG_HOME}/X11/xcompose\n```\n" }, { "path": "${HOME}/.compose-cache", - "moveable": true, + "movable": true, "help": "Export the following environment variables:\n\n```bash\nexport XCOMPOSECACHE=${XDG_CACHE_HOME}/X11/xcompose\n```\n" } ] -- 2.47.3 From fa4be24f0ad41285c2d8dea8e343eb2296b8fa99 Mon Sep 17 00:00:00 2001 From: Viking at RAGE Date: Tue, 17 May 2022 00:41:58 +0100 Subject: [PATCH 04/16] Update git.json to mention .git-credential --- programs/git.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/programs/git.json b/programs/git.json index e0a5248..697808c 100644 --- a/programs/git.json +++ b/programs/git.json @@ -5,6 +5,11 @@ "path": "$HOME/.gitconfig", "movable": true, "help": "XDG is supported out-of-the-box, so we can simply move the file to _XDG_CONFIG_HOME/git/config_.\n" + }, + { + "path": "$HOME/.git-credentials", + "movable": true, + "help": "XDG is supported out-of-the-box, so we can simply move the file to _XDG_CONFIG_HOME/git/credentials_.\n" } ] } -- 2.47.3 From c3cd240142ee58ce105792e8072d06de9be9b0b5 Mon Sep 17 00:00:00 2001 From: b3nj5m1n <47924309+b3nj5m1n@users.noreply.github.com> Date: Tue, 17 May 2022 02:32:31 +0000 Subject: [PATCH 05/16] Create shellcheck.yml --- .github/workflows/shellcheck.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .github/workflows/shellcheck.yml diff --git a/.github/workflows/shellcheck.yml b/.github/workflows/shellcheck.yml new file mode 100644 index 0000000..e982434 --- /dev/null +++ b/.github/workflows/shellcheck.yml @@ -0,0 +1,18 @@ +name: Shellcheck + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + shellcheck: + name: Shellcheck + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Run ShellCheck + uses: ludeeus/action-shellcheck@master -- 2.47.3 From a0dad7d822c0eb148025e2b68972fac5c330d069 Mon Sep 17 00:00:00 2001 From: Talvi Date: Tue, 17 May 2022 12:43:06 +0200 Subject: [PATCH 06/16] Suggest XDG_CACHE_HOME instead of XDG_DATA_HOME Since it is a history file, i would consider it non-essential. --- programs/sqlite.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/programs/sqlite.json b/programs/sqlite.json index 205ddfa..2538d6d 100644 --- a/programs/sqlite.json +++ b/programs/sqlite.json @@ -3,8 +3,8 @@ { "path": "$HOME/.sqlite_history", "movable": true, - "help": "Export the following environment variables:\n\n```bash\nexport SQLITE_HISTORY=$XDG_DATA_HOME/sqlite_history\n```\n" + "help": "Export the following environment variables:\n\n```bash\nexport SQLITE_HISTORY=$XDG_CACHE_HOME/sqlite_history\n```\n" } ], "name": "sqlite" -} \ No newline at end of file +} -- 2.47.3 From aa7873edfc2550a114711789e804c4ea7f975f1a Mon Sep 17 00:00:00 2001 From: Sebastian Willenbrink Date: Tue, 17 May 2022 00:08:16 +0200 Subject: [PATCH 07/16] Replace >>= with do-notation --- app/add-program.hs | 96 ++++++++++++++++++++++------------------------ 1 file changed, 46 insertions(+), 50 deletions(-) diff --git a/app/add-program.hs b/app/add-program.hs index 4d71ea6..1349349 100644 --- a/app/add-program.hs +++ b/app/add-program.hs @@ -46,29 +46,23 @@ save program = do B.writeFile path (encodePretty program) getHelp :: IO String -getHelp = - toString <$> Data.UUID.V4.nextRandom >>= \id -> - appendFile ("/tmp/xdg-ninja." ++ id ++ ".md") "Export the following environment variables:\n\n```bash\n\n```" - >> (getEnv "EDITOR") >>= \editor -> - createProcess (shell (editor ++ " /tmp/xdg-ninja." ++ id ++ ".md")) >>= \r -> - case r of - (_, _, _, p) -> - waitForProcess p - >>= ( \f -> case f of - ExitSuccess -> readFile ("/tmp/xdg-ninja." ++ id ++ ".md") - (ExitFailure a) -> return "" - ) +getHelp = do + id <- toString <$> Data.UUID.V4.nextRandom + editor <- appendFile ("/tmp/xdg-ninja." ++ id ++ ".md") "Export the following environment variables:\n\n```bash\n\n```" >> (getEnv "EDITOR") + (_, _, _, p) <- createProcess (shell (editor ++ " /tmp/xdg-ninja." ++ id ++ ".md")) + f <- waitForProcess p + case f of + ExitSuccess -> readFile ("/tmp/xdg-ninja." ++ id ++ ".md") + ExitFailure a -> return "" getProp :: T.Text -> T.Text -> IO String getProp prompt placeholder = do let string_prompt = T.unpack prompt let string_placholder = T.unpack placeholder - let fuck = runInputT defaultSettings (getInputLineWithInitial string_prompt (string_placholder, "")) - fuck - >>= ( \x -> case x of - (Just s) -> return s - Nothing -> return "" - ) + x <- runInputT defaultSettings (getInputLineWithInitial string_prompt (string_placholder, "")) + case x of + Just s -> return s + Nothing -> return "" data Answer = Yes | No | Unknown @@ -83,48 +77,50 @@ stringToBool s = case lower s of _ -> Unknown promptBool :: T.Text -> T.Text -> T.Text -> IO Bool -promptBool prompt prompt_unrecognised placeholder = - getProp prompt placeholder >>= \x -> case stringToBool x of +promptBool prompt prompt_unrecognised placeholder = do + x <- getProp prompt placeholder + case stringToBool x of Yes -> return True No -> return False Unknown -> printf "%s\n" prompt_unrecognised >> promptBool prompt prompt_unrecognised placeholder getFile :: IO File -getFile = - getProp (blue "Path to file: ") "$HOME/." - >>= \path -> - promptBool (blue "Can the file be moved? (y/n) ") (red "Please provide a valid answer.") "y" - >>= \movable -> - getHelp - >>= \help -> return File {path = path, movable = movable, help = help} +getFile = do + path <- getProp (blue "Path to file: ") "$HOME/." + movable <- promptBool (blue "Can the file be moved? (y/n) ") (red "Please provide a valid answer.") "y" + help <- getHelp + return File {path = path, movable = movable, help = help} getFiles :: [File] -> IO [File] getFiles files = if Data.List.Extra.null files - then getFile >>= \newFile -> getFiles (newFile : files) - else - promptBool (green "Add another file? (y/n) ") (red "Please provide a valid answer.") "" >>= \new -> - if new - then getFile >>= \newFile -> getFiles (newFile : files) - else return files + then do + newFile <- getFile + getFiles (newFile : files) + else do + new <- promptBool (green "Add another file? (y/n) ") (red "Please provide a valid answer.") "" + if new + then do + newFile <- getFile + getFiles (newFile : files) + else return files getProgram :: IO Program -getProgram = - printf "%s\n" (T.unpack (bold (cyan "XDG-ninja Configuration Wizard"))) - >> printf "%s\n" (T.unpack (faint (italic (cyan "First, tell me what program you're creating a configuration for.")))) - >> getProp (yellow "Program name: ") "" - >>= \name -> - printf "%s\n" (T.unpack (faint (italic (cyan "Alright, now let's configure which files belong to this program.")))) - >> printf "%s\n" (T.unpack (faint (italic (cyan "I'm going to ask you for the path to the file, please use $HOME instead of ~.")))) - >> printf "%s\n" (T.unpack (faint (italic (cyan "I'll then ask you wether or not this file can be moved to a different directory.")))) - >> printf "%s\n" (T.unpack (faint (italic (cyan "Finally, your editor is going to open a markdown document. Enter instructions on moving the file in question, then save and close.")))) - >> getFiles [] >>= \files -> - return Program {name = T.pack name, files = files} +getProgram = do + name <- printf "%s\n" (T.unpack (bold (cyan "XDG-ninja Configuration Wizard"))) + >> printf "%s\n" (T.unpack (faint (italic (cyan "First, tell me what program you're creating a configuration for.")))) + >> getProp (yellow "Program name: ") "" + files <- printf "%s\n" (T.unpack (faint (italic (cyan "Alright, now let's configure which files belong to this program.")))) + >> printf "%s\n" (T.unpack (faint (italic (cyan "I'm going to ask you for the path to the file, please use $HOME instead of ~.")))) + >> printf "%s\n" (T.unpack (faint (italic (cyan "I'll then ask you wether or not this file can be moved to a different directory.")))) + >> printf "%s\n" (T.unpack (faint (italic (cyan "Finally, your editor is going to open a markdown document. Enter instructions on moving the file in question, then save and close.")))) + >> getFiles [] + return Program {name = T.pack name, files = files} main :: IO () -main = - getProgram >>= \program -> - promptBool (green "Save? (y/n) ") (red "Please provide a valid answer.") "" >>= \do_save -> - if do_save - then save program - else return () +main = do + program <- getProgram + do_save <- promptBool (green "Save? (y/n) ") (red "Please provide a valid answer.") "" + if do_save + then save program + else return () -- 2.47.3 From 8a5719c9ffed2cef9594d9057b244860ed5efddf Mon Sep 17 00:00:00 2001 From: BlueBoxWare Date: Tue, 17 May 2022 15:50:42 +0200 Subject: [PATCH 08/16] Add configuration for IntelliJ downloaded JDKs. --- programs/intellij | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 programs/intellij diff --git a/programs/intellij b/programs/intellij new file mode 100644 index 0000000..160a045 --- /dev/null +++ b/programs/intellij @@ -0,0 +1,10 @@ +{ + "files": [ + { + "path": "$HOME/.jdks", + "movable": true, + "help": "Add ```-Djdk.downloader.home=``` to the IntelliJ Custom VM options.\n\nSee: [here](https://youtrack.jetbrains.com/issue/IDEA-254464)." + } + ], + "name": "since" +} -- 2.47.3 From 3cb17d01c04516c3486b750da447f050e130518a Mon Sep 17 00:00:00 2001 From: BlueBoxWare Date: Tue, 17 May 2022 15:54:38 +0200 Subject: [PATCH 09/16] Fix name. --- programs/intellij | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/programs/intellij b/programs/intellij index 160a045..da49f35 100644 --- a/programs/intellij +++ b/programs/intellij @@ -6,5 +6,5 @@ "help": "Add ```-Djdk.downloader.home=``` to the IntelliJ Custom VM options.\n\nSee: [here](https://youtrack.jetbrains.com/issue/IDEA-254464)." } ], - "name": "since" + "name": "intellij" } -- 2.47.3 From 3226b15c32cf4aa9f4491ed6b949e9100b2c80dc Mon Sep 17 00:00:00 2001 From: b3nj4m1n Date: Tue, 17 May 2022 19:41:11 +0200 Subject: [PATCH 10/16] Add Network Security Services config --- programs/nss.json | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 programs/nss.json diff --git a/programs/nss.json b/programs/nss.json new file mode 100644 index 0000000..34b6c0c --- /dev/null +++ b/programs/nss.json @@ -0,0 +1,10 @@ +{ + "files": [ + { + "path": "$HOME/.pki", + "movable": true, + "help": "XDG is supported out-of-the-box, so we can simply move the file to _XDG_DATA_HOME/pki_.\n" + } + ], + "name": "nss" +} \ No newline at end of file -- 2.47.3 From d6e4de0e68920c57779361f6983f884ef2e8d9e6 Mon Sep 17 00:00:00 2001 From: b3nj4m1n Date: Wed, 18 May 2022 11:35:59 +0200 Subject: [PATCH 11/16] Add config for .python_history --- programs/python.json | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 programs/python.json diff --git a/programs/python.json b/programs/python.json new file mode 100644 index 0000000..c4e02a3 --- /dev/null +++ b/programs/python.json @@ -0,0 +1,10 @@ +{ + "files": [ + { + "path": "$HOME/.python_history", + "movable": true, + "help": "Export the following environment variables:\n\n```bash\nexport PYTHONSTARTUP=\"${XDG_CONFIG_HOME}/python/pythonrc\"\n```\n\nNow create the file _pythonrc_, and put the following code into it:\n\n```python\nimport os\nimport atexit\nimport readline\n\nhistory = os.path.join(os.environ['XDG_CACHE_HOME'], 'python_history')\ntry:\n readline.read_history_file(history)\nexcept OSError:\n pass\n\ndef write_history():\n try:\n readline.write_history_file(history)\n except OSError:\n pass\n\natexit.register(write_history)\n```\n\n_Credit:_ https://unix.stackexchange.com/a/675631/417527\n" + } + ], + "name": "python" +} -- 2.47.3 From debb51a88ad50c2018407d255dea649f31265bb9 Mon Sep 17 00:00:00 2001 From: b3nj4m1n Date: Wed, 18 May 2022 14:15:28 +0200 Subject: [PATCH 12/16] Add android-studio, bubblewrap and expo configs --- programs/android-studio.json | 10 ++++++++++ programs/bubblewrap.json | 10 ++++++++++ programs/expo.json | 10 ++++++++++ 3 files changed, 30 insertions(+) create mode 100644 programs/android-studio.json create mode 100644 programs/bubblewrap.json create mode 100644 programs/expo.json diff --git a/programs/android-studio.json b/programs/android-studio.json new file mode 100644 index 0000000..0bccf02 --- /dev/null +++ b/programs/android-studio.json @@ -0,0 +1,10 @@ +{ + "files": [ + { + "path": "$HOME/.android", + "movable": true, + "help": "Export the following environment variables:\n\n```bash\nexport ANDROID_HOME=$XDG_DATA_HOME/android\n```\n" + } + ], + "name": "android-studio" +} \ No newline at end of file diff --git a/programs/bubblewrap.json b/programs/bubblewrap.json new file mode 100644 index 0000000..d7a3336 --- /dev/null +++ b/programs/bubblewrap.json @@ -0,0 +1,10 @@ +{ + "files": [ + { + "path": "$HOME/.bubblewrap", + "movable": false, + "help": "Currently unsupported.\n\n_Relevant issue:_ https://github.com/GoogleChromeLabs/bubblewrap/issues/362\n" + } + ], + "name": "bubblewrap" +} \ No newline at end of file diff --git a/programs/expo.json b/programs/expo.json new file mode 100644 index 0000000..3f0e70b --- /dev/null +++ b/programs/expo.json @@ -0,0 +1,10 @@ +{ + "files": [ + { + "path": "$HOME/.expo", + "movable": false, + "help": "" + } + ], + "name": "expo" +} \ No newline at end of file -- 2.47.3 From 35a7b91a7a67596d4004eb76a718a055a6baf91a Mon Sep 17 00:00:00 2001 From: b3nj4m1n Date: Wed, 18 May 2022 14:18:20 +0200 Subject: [PATCH 13/16] Add dotnet config --- programs/dotnet.json | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 programs/dotnet.json diff --git a/programs/dotnet.json b/programs/dotnet.json new file mode 100644 index 0000000..493b6aa --- /dev/null +++ b/programs/dotnet.json @@ -0,0 +1,10 @@ +{ + "files": [ + { + "path": "$HOME/.dotnet", + "movable": false, + "help": "Currently unsupported.\n\n_Relevant issue:_ https://github.com/dotnet/sdk/issues/8678\n" + } + ], + "name": "dotnet" +} \ No newline at end of file -- 2.47.3 From 78d39de68357c9cdf0703f5c5a63888381c71f0f Mon Sep 17 00:00:00 2001 From: b3nj4m1n Date: Wed, 18 May 2022 15:53:30 +0200 Subject: [PATCH 14/16] Add templates to add-program --- app/add-program.hs | 46 ++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 38 insertions(+), 8 deletions(-) diff --git a/app/add-program.hs b/app/add-program.hs index 1349349..e5498aa 100644 --- a/app/add-program.hs +++ b/app/add-program.hs @@ -4,6 +4,7 @@ -- I do not know haskell, this code is probably shit import Data.Aeson +import Data.Aeson.Types import Data.Aeson.Encode.Pretty import qualified Data.ByteString.Lazy as B import Data.List.Extra @@ -23,13 +24,13 @@ import Text.Printf (printf) data File = File { path :: String, - movable :: Bool, + supportLevel :: SupportLevel, help :: String } deriving (Generic, Show) instance ToJSON File where - toEncoding = genericToEncoding defaultOptions + toEncoding (File path supportLevel help) = pairs ("path" .= path <> "movable" .= supportLevel <> "help" .= help) data Program = Program { name :: T.Text, @@ -45,10 +46,24 @@ save program = do let path = ("./programs/" ++ (T.unpack (name program)) ++ ".json") B.writeFile path (encodePretty program) -getHelp :: IO String -getHelp = do +data SupportLevel = Unsupported | Alias | EnvVars | Supported + deriving (Generic, Show) + +instance ToJSON SupportLevel where + toEncoding Unsupported = toEncoding ( Bool False ) + toEncoding _ = toEncoding ( Bool True ) + +getTemplate :: SupportLevel -> String +getTemplate Unsupported = "Currently unsupported.\n\n_Relevant issue:_ https://github.com/user/repo/issues/nr\n" +getTemplate EnvVars = "Export the following environment variables:\n\n```bash\n\n```" +getTemplate Alias = "Alias PROGRAM to use a custom configuration location:\n\n```bash\nalias PROGRAM=PROGRAM --config \"$XDG_CONFIG_HOME\"/PROGRAM/config\n```\n" +getTemplate Supported = "Supported since _VERSION_.\n\nYou can move the file to _XDG_CONFIG_HOME/PROGRAM/CONFIG.\n" + + +getHelp :: SupportLevel -> IO String +getHelp supportLevel = do id <- toString <$> Data.UUID.V4.nextRandom - editor <- appendFile ("/tmp/xdg-ninja." ++ id ++ ".md") "Export the following environment variables:\n\n```bash\n\n```" >> (getEnv "EDITOR") + editor <- appendFile ("/tmp/xdg-ninja." ++ id ++ ".md") (getTemplate supportLevel) >> (getEnv "EDITOR") (_, _, _, p) <- createProcess (shell (editor ++ " /tmp/xdg-ninja." ++ id ++ ".md")) f <- waitForProcess p case f of @@ -84,12 +99,27 @@ promptBool prompt prompt_unrecognised placeholder = do No -> return False Unknown -> printf "%s\n" prompt_unrecognised >> promptBool prompt prompt_unrecognised placeholder +getSupportLevel :: IO SupportLevel +getSupportLevel = do + movable <- promptBool (blue "Can the file be moved? (y/n) ") (red "Please provide a valid answer.") "y" + if movable + then do + envVars <- promptBool (blue "Do you have to export environment variables? (y/n) ") (red "Please provide a valid answer.") "y" + if envVars + then return EnvVars + else do + alias <- promptBool (blue "Do you have to set an alias? (y/n) ") (red "Please provide a valid answer.") "y" + if alias + then return Alias + else return Supported + else return Unsupported + getFile :: IO File getFile = do path <- getProp (blue "Path to file: ") "$HOME/." - movable <- promptBool (blue "Can the file be moved? (y/n) ") (red "Please provide a valid answer.") "y" - help <- getHelp - return File {path = path, movable = movable, help = help} + supportLevel <- getSupportLevel + help <- getHelp supportLevel + return File {path = path, supportLevel = supportLevel, help = help} getFiles :: [File] -> IO [File] getFiles files = -- 2.47.3 From e05e0765bb5701d1bf772d4380c647d0ac92db1d Mon Sep 17 00:00:00 2001 From: b3nj4m1n Date: Wed, 18 May 2022 16:09:38 +0200 Subject: [PATCH 15/16] Formatting with stylish-haskell --- app/add-program.hs | 62 +++++++++++++++++++++++----------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/app/add-program.hs b/app/add-program.hs index e5498aa..a1446a3 100644 --- a/app/add-program.hs +++ b/app/add-program.hs @@ -1,31 +1,31 @@ -{-# LANGUAGE DeriveGeneric #-} +{-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE OverloadedStrings #-} -- I do not know haskell, this code is probably shit -import Data.Aeson -import Data.Aeson.Types -import Data.Aeson.Encode.Pretty -import qualified Data.ByteString.Lazy as B -import Data.List.Extra -import Data.Maybe -import qualified Data.Text as T -import Data.Text.ANSI -import Data.UUID -import Data.UUID.V4 -import GHC.Float (double2Float) -import GHC.Generics -import System.Console.Haskeline -import System.Environment (getEnv) -import System.Exit -import System.IO -import System.Process -import Text.Printf (printf) +import Data.Aeson +import Data.Aeson.Encode.Pretty +import Data.Aeson.Types +import qualified Data.ByteString.Lazy as B +import Data.List.Extra +import Data.Maybe +import qualified Data.Text as T +import Data.Text.ANSI +import Data.UUID +import Data.UUID.V4 +import GHC.Float (double2Float) +import GHC.Generics +import System.Console.Haskeline +import System.Environment (getEnv) +import System.Exit +import System.IO +import System.Process +import Text.Printf (printf) data File = File - { path :: String, + { path :: String, supportLevel :: SupportLevel, - help :: String + help :: String } deriving (Generic, Show) @@ -33,7 +33,7 @@ instance ToJSON File where toEncoding (File path supportLevel help) = pairs ("path" .= path <> "movable" .= supportLevel <> "help" .= help) data Program = Program - { name :: T.Text, + { name :: T.Text, files :: [File] } deriving (Generic, Show) @@ -51,7 +51,7 @@ data SupportLevel = Unsupported | Alias | EnvVars | Supported instance ToJSON SupportLevel where toEncoding Unsupported = toEncoding ( Bool False ) - toEncoding _ = toEncoding ( Bool True ) + toEncoding _ = toEncoding ( Bool True ) getTemplate :: SupportLevel -> String getTemplate Unsupported = "Currently unsupported.\n\n_Relevant issue:_ https://github.com/user/repo/issues/nr\n" @@ -67,7 +67,7 @@ getHelp supportLevel = do (_, _, _, p) <- createProcess (shell (editor ++ " /tmp/xdg-ninja." ++ id ++ ".md")) f <- waitForProcess p case f of - ExitSuccess -> readFile ("/tmp/xdg-ninja." ++ id ++ ".md") + ExitSuccess -> readFile ("/tmp/xdg-ninja." ++ id ++ ".md") ExitFailure a -> return "" getProp :: T.Text -> T.Text -> IO String @@ -76,7 +76,7 @@ getProp prompt placeholder = do let string_placholder = T.unpack placeholder x <- runInputT defaultSettings (getInputLineWithInitial string_prompt (string_placholder, "")) case x of - Just s -> return s + Just s -> return s Nothing -> return "" data Answer = Yes | No | Unknown @@ -84,12 +84,12 @@ data Answer = Yes | No | Unknown stringToBool :: String -> Answer stringToBool s = case lower s of "yes" -> Yes - "y" -> Yes - "1" -> Yes - "no" -> No - "n" -> No - "0" -> No - _ -> Unknown + "y" -> Yes + "1" -> Yes + "no" -> No + "n" -> No + "0" -> No + _ -> Unknown promptBool :: T.Text -> T.Text -> T.Text -> IO Bool promptBool prompt prompt_unrecognised placeholder = do -- 2.47.3 From f48b1c8307e5ccc490ed4d949bed53f8120617a8 Mon Sep 17 00:00:00 2001 From: b3nj4m1n Date: Thu, 19 May 2022 01:26:19 +0200 Subject: [PATCH 16/16] Remove redundant config --- programs/nvidia.json | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 programs/nvidia.json diff --git a/programs/nvidia.json b/programs/nvidia.json deleted file mode 100644 index da2e710..0000000 --- a/programs/nvidia.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "files": [ - { - "path": "$HOME/.nv", - "movable": true, - "help": "Uses _XDG_CACHE_HOME_ if it is set.\n" - } - ], - "name": "nvidia" -} \ No newline at end of file -- 2.47.3