config/shell: improve some script documentation

This commit is contained in:
xeruf 2022-04-26 13:26:22 +02:00
parent 4d5b5893da
commit e8078f3e6f
3 changed files with 7 additions and 4 deletions

View File

@ -24,5 +24,5 @@
(add-to-list 'recentf-exclude "writing\\/tug") (add-to-list 'recentf-exclude "writing\\/tug")
(add-to-list 'recentf-exclude "\\.\\(sync\\|stversions\\|stfolder\\)") (add-to-list 'recentf-exclude "\\.\\(sync\\|stversions\\|stfolder\\)")
(add-to-list 'recentf-list (expand-file-name "4-incubator/downloads/" user-data-dir)) (add-to-list 'recentf-list (expand-file-name "4-incubator/downloads/" user-data-dir))
;(setq recentf-keep '(recentf-keep-default-predicate file-remote-p)) (setq recentf-keep '(recentf-keep-default-predicate file-remote-p "/ssh:.*"))
) )

View File

@ -53,7 +53,7 @@ cd() {
# LOCATE {{{1 # LOCATE {{{1
# TODO no double heading with bat # TODO no double heading with bat
alias fselect='fzf -0 -1 --reverse --height=30% | while read f; do test -d "$f" && cd "$f" || { highlight "$f" && b "$f" }; done' alias fselect='fzf -0 -1 --reverse --height=30% | while read f; do test -d "$f" && cd "$f" || { highlight "$f" && print -s "b $f" && b "$f" }; done'
loci() { loci() {
locate --all --ignore-case --basename --existing "$@" | locate --all --ignore-case --basename --existing "$@" |
command grep --extended-regexp --ignore-case --color=always $(echo "$|${@:$#}" | sed 's/ /|/g') | command grep --extended-regexp --ignore-case --color=always $(echo "$|${@:$#}" | sed 's/ /|/g') |

View File

@ -1,11 +1,14 @@
#!/bin/sh -e #!/bin/bash -e
# Clones a fork and sets a corresponding upstream # Clones a fork and sets a corresponding upstream
# ARGS # ARGS
# - repo name (omit if setting upstream in existing repo) # - repo name (omit if setting upstream in existing repo)
# - upstream user # - upstream user
# - local user # - own user
# - url # - url
# - target directory name (and further arguments to clone) # - target directory name (and further arguments to clone)
# In an existing repo, first arg is omitted
test $# -eq 0 && echo "Usage: $0 [repo] [upstream owner] [own user] [url]" && exit 2
# TODO check from subdir
if test -d ".git" if test -d ".git"
then repo="$(basename "$PWD")" then repo="$(basename "$PWD")"
git remote set-url origin "$(git-repo "${3:-github.com}" "$repo" "$2" "${@:4}")" git remote set-url origin "$(git-repo "${3:-github.com}" "$repo" "$2" "${@:4}")"