Skip to content
Open
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
32 changes: 32 additions & 0 deletions swallow.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/sh
#
# swallow
# fyr - 2020 (c) MIT

usage() {
base=$(basename "$0")

cat >&2 << EOF
Usage:
$base "program" "arguments"
EOF

[ $# -eq 0 ] || exit "$1"
}

main() {
[ -z "$*" ] && usage 1

# test first argument as a command and only proceed if it exists on $PATH
if type "$1" > /dev/null 2>&1; then
PFW="$(pfw)"
mapw -u "$PFW"

printf '%s\n' "$*" | ${SHELL:-"/bin/sh"}

mapw -m "$PFW"
focus.sh "$PFW"
fi
}

main "$@"