Skip to content

Commit

Permalink
July 2020 (#82)
Browse files Browse the repository at this point in the history
  • Loading branch information
denisidoro authored Jul 6, 2020
1 parent 35f028f commit 2aab079
Show file tree
Hide file tree
Showing 170 changed files with 1,254 additions and 529 deletions.
29 changes: 21 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
# Based on https://github.com/actions-rs/meta/blob/master/recipes/quickstart.md
#
# While our "example" application has the platform-specific code,
# for simplicity we are compiling and testing everything on the Ubuntu environment only.
# For multi-OS testing see the `cross.yml` workflow.

on: [push]

Expand All @@ -15,10 +11,8 @@ jobs:
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Create stubs
run: mkdir -p ./target; echo -e '#!/usr/bin/env bash\n\necho usage' > ./target/dotrs && chmod +x ./target/dotrs
- name: Run tests
run: DOT_STUB_DOTRS=true ./bin/dot self test suite bash
run: DOT_STUB_DOTRS=true PROJ_HOME=$(pwd)/rust PROJ_NAME=dotrs ./bin/dot self test suite bash

js-tests:
name: Javascript
Expand All @@ -28,6 +22,8 @@ jobs:
uses: actions/checkout@v2
- name: Setup NodeJS
uses: actions/setup-node@v1
- name: Install tools
run: sudo ./bin/dot pkg add jsmin jq
- name: Run tests
run: ./bin/dot self test suite js

Expand Down Expand Up @@ -56,4 +52,21 @@ jobs:
command: test
working-directory: ./rust
- name: Run tests
run: ./bin/dot self test suite rust
run: DOT_SKIP_CARGO=true ./bin/dot self test suite rust

install-tests:
name: Install
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Cleanup
run: cd $HOME && for f in $(ls -a | grep '^\.'); do rm "$f" || true; done
- name: dot self install
run: EDITOR=cat TERM=dumb DOT_INSTALL_SKIP_UPDATE=true DOT_DOCOPT=python DOT_FRE=false DOT_FZF=false DOT_NAVI=false DOT_ZIM=false DOT_STARSHIP=false ./bin/dot self install
- name: DOTFILES bashrc
run: cat $HOME/.bashrc | grep DOTFILES
- name: DOTFILES env variable
run: bash -c 'source $HOME/.bashrc; env | grep DOTFILES'
- name: dot version
run: bash -c 'source $HOME/.bashrc; dot --version | grep -E '^202[0-9]\.[0-9]+\.[0-9]+$''
5 changes: 3 additions & 2 deletions bin/dot
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,9 @@ if [[ $# -eq 0 ]]; then
# Shows available contexts
# or prompts for a command if fzf is installed
source "$DOTFILES/scripts/core/main.sh"
source "$DOTFILES/scripts/core/coll.sh"

platform::command_exists fzf \
has fzf \
&& fzf_prompt "$(list_command_paths)" \
|| list_contexts "$(list_command_paths)"

Expand All @@ -138,7 +139,7 @@ elif [[ $# -eq 1 ]]; then
context_query="$(_alias $1)"

case $context_query in
-h|--help) docs::invalid "$@" && exit ;;
-h|--help) doc::help_or_fail "$@" && exit ;;
-v|--version) cat "${DOTFILES}/rust/Cargo.toml" | grep version | head -n1 | grep -Eo '[0-9\.]+' && exit ;;
esac

Expand Down
18 changes: 13 additions & 5 deletions editors/vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"window.zoomLevel": 0,
"window.zoomLevel": 1,
"editor.fontSize": 12,
"editor.fontFamily": "Hack Nerd Font",
"editor.letterSpacing": 0.2,
Expand All @@ -8,8 +8,8 @@
"editor.renderWhitespace": "none",
"files.autoSave": "onFocusChange",
"files.trimFinalNewlines": true,
"editor.formatOnPaste": true,
"editor.formatOnSave": true,
// "editor.formatOnPaste": true,
// "editor.formatOnSave": true,
"editor.minimap.enabled": false,
"editor.mouseWheelZoom": true,
"explorer.sortOrder": "default",
Expand Down Expand Up @@ -70,7 +70,11 @@
"**/vendor": true,
"**/go-build": true,
"bazel-*": true,
"pkg*": true
"pkg*": true,
"**/.classpath": true,
"**/.project": true,
"**/.settings": true,
"**/.factorypath": true
},
"files.watcherExclude": {
"bazel-*": true,
Expand Down Expand Up @@ -1425,5 +1429,9 @@
"explorer.confirmDelete": false,
"editor.wordWrap": "on",
"javascript.validate.enable": false,
"javascript.updateImportsOnFileMove.enabled": "always"
"javascript.updateImportsOnFileMove.enabled": "always",
"editor.suggestSelection": "first",
"vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
"java.semanticHighlighting.enabled": true,
"java.requirements.JDK11Warning": false
}
7 changes: 6 additions & 1 deletion git/config
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,9 @@
pushInsteadOf = "gist:"

[url "[email protected]:denisidoro/"]
insteadOf = "my:"
insteadOf = "my:"
[credential]
helper = ""
helper = manager-core
[credential "https://dev.azure.com"]
useHttpPath = true
11 changes: 11 additions & 0 deletions links/android.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
dotfiles/local,dotfiles
miMind/maps,miMind
DraStic/backup,DraStic
dolphin-emu/GC,Dolphin/GC
dolphin-emu/Wii,Dolphin/Wii
Johnemulators/GBC/save,JohnGBC
PSP/SAVEDATA,PPSSPP
MyBoy/save,MyBoy
memento/backup,Memento
RetroArch/saves,RetroArch
citra-emu/sdmc/Nintendo 3DS/00000000000000000000000000000000/00000000000000000000000000000000/title/,Citra
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions links/unix.yaml → links/unix.csv
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
shell/zsh/zshrc, $HOME/.zshrc
shell/zsh/zimrc, $HOME/.zimrc
shell/zsh/zimrc, $HOME/.zim/.zimrc
shell/bash/bashrc, $HOME/.bashrc
shell/bash/profile, $HOME/.bash_profile
shell/bash/profile, $HOME/.profile
Expand Down
File renamed without changes.
3 changes: 2 additions & 1 deletion scripts/book/cover
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
set -uo pipefail

source "${DOTFILES}/scripts/core/main.sh"
source "${DOTFILES}/scripts/core/str.sh"

##? Gets cover for books
##?
Expand All @@ -12,7 +13,7 @@ source "${DOTFILES}/scripts/core/main.sh"
##? -d --display Show image instead of printing the URL
##? -z --zoom <zoom> Zoom level [default: 0]

docs::eval "$@"
doc::parse "$@"

get_json() {
local -r query="$(str::urlencode "$1")"
Expand Down
3 changes: 2 additions & 1 deletion scripts/browser/google-lucky
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
set -euo pipefail

source "${DOTFILES}/scripts/core/main.sh"
source "${DOTFILES}/scripts/core/str.sh"

##? Opens a webpage directly via DuckDuckGo's "feeling lucky"
##?
##? Usage:
##? google-lucky <query>

docs::eval "$@"
doc::parse "$@"

url="https://duckduckgo.com/?q=%21+$(str::urlencode "$query")&ia=web"
dot system open "$url"
2 changes: 1 addition & 1 deletion scripts/cloud/s3
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ source "${DOTFILES}/scripts/core/nav.sh"
##? Usage:
##? nav [<path>]

docs::eval_help "$@"
doc::maybe_help "$@"

s3::path() {
local -r path="$1"
Expand Down
9 changes: 5 additions & 4 deletions scripts/code/beautify
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
#!/usr/bin/env bash
set -uo pipefail
set -uo pipefail

source "${DOTFILES}/scripts/core/main.sh"
source "${DOTFILES}/scripts/core/log.sh"

##? Source code indentation fixer
##?
##? Usage:
##? beautify <filename>

docs::eval "$@"
doc::parse "$@"

_get_language() {
local -r filename="$1"
Expand Down Expand Up @@ -54,8 +55,8 @@ case "$language" in
sh)
beautysh -i 3 -s paronly "$filename"
sed -i -e 's/() ::/::/g' "$filename"
shellcheck -f diff "$filename" | git apply
shellcheck "$filename"
# shellcheck -f diff "$filename" | git apply
# shellcheck "$filename"
;;
json)
cat "$filename" | jq . > "$filename"
Expand Down
28 changes: 28 additions & 0 deletions scripts/code/vscode
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env bash
set -euo pipefail

_code() {
local target="${1:-$PWD}"
[[ "$target" == "." ]] && target="$PWD"
[[ "$target" == "$HOME" ]] && echoerr "Can't open the whole home dir in VSCode" && return 1

# local full_target
# [[ "$target" == /* ]] && full_target="$target" || full_target="${PWD}/${target}"

# local cwd
# [[ -d "$full_target" ]] && cwd="$full_target" || cwd="$(dirname "$full_target")"

# export VSCODE_CWD="$cwd"
# export APP_ROOT="$cwd"

[[ $# -gt 0 ]] && shift

local -r osx_path="/Applications/Visual Studio Code.app/Contents/Resources/app/bin/code"
if [ -f "$osx_path" ]; then
"$osx_path" "$target" "$@"
else
command code "$target" "$@"
fi
}

_code "$@"
21 changes: 20 additions & 1 deletion scripts/core/coll.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env bash

source "${DOTFILES}/scripts/core/str.sh"

coll::new() {
for x in "$@"; do
echo "$x"
Expand Down Expand Up @@ -81,4 +83,21 @@ coll::reduce() {
local -r new_state="$("$fn" "$state" "$x")"
echo "$coll" | coll::rest | coll::reduce "$fn" "$new_state"
fi
}
}

coll::is_empty() {
local var=${1}
[[ -z ${var} ]]
}

coll::contains_element() {
elements="${@:2}"
element="${1}"

for e in "${elements[@]}"; do
if [[ "$e" == "${element}" ]]; then
return 1
fi
done
return 0
}
18 changes: 0 additions & 18 deletions scripts/core/collections.sh

This file was deleted.

2 changes: 2 additions & 0 deletions scripts/core/dict.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
# values with non-trivial whitespaces (newlines, subsequent spaces, etc)
# aren't handled very well

source "${DOTFILES}/scripts/core/str.sh"

dict::new() {
if [ $# = 0 ]; then
echo ""
Expand Down
34 changes: 0 additions & 34 deletions scripts/core/documentation.sh

This file was deleted.

4 changes: 3 additions & 1 deletion scripts/core/feedback.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env bash

source "${DOTFILES}/scripts/core/log.sh"

feedback::confirmation() {
local -r msg="$1"
local -r default_yes="${2:-true}"
Expand Down Expand Up @@ -64,7 +66,7 @@ feedback::select_option() {
local -r options="$(cat)"
local -r question="${1:-Select a number}"

if platform::command_exists fzf; then
if has fzf; then
local height="$(echo "$options" | wc -l)"
height="$((height + 2))"
echo "$options" \
Expand Down
36 changes: 0 additions & 36 deletions scripts/core/filesystem.sh

This file was deleted.

Loading

0 comments on commit 2aab079

Please sign in to comment.