dotfiles

My configuration files.
Log | Files | Refs | README

commit 9e06292cb3e07b57775211242c3b6afdaa956d4e
parent c2ab59e3cc0106aa203e3ef96e07a916b8b4c348
Author: Sven Möller <sven-moeller@outlook.de>
Date:   Tue, 14 Dec 2021 23:28:29 +0100

Generalize

Diffstat:
Mbin/.local/bin/bm | 14++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/bin/.local/bin/bm b/bin/.local/bin/bm @@ -10,6 +10,13 @@ archive_file="$BM_DIR/archive.txt" export GIT_WORK_TREE="$BM_DIR" export GIT_DIR="$BM_DIR/.git" +_get_url () { + [ -z "$2" ] \ + && file="$urls_file" \ + || file="$2" + sed -n "$1p" "$file" | awk '{print $1}' +} + add () { url="$1" cat "$urls_file" "$archive_file" | grep "$url" \ @@ -56,12 +63,7 @@ delete () { } open () { - [ -z "$2" ] \ - && file="$urls_file" \ - || file="$2" - url="$(sed -n "$1p" "$file" | awk '{print $1}')" - - xdg-open "$url" + xdg-open "$(_get_url "$@")" } interactive () {