Skip to content

Commit

Permalink
Add COD_NONAME=1 support
Browse files Browse the repository at this point in the history
  • Loading branch information
newbthenewbd committed Apr 4, 2022
1 parent f0a1b4b commit 8fe613d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ runs **ls -Al** in it.
**cod** is intended for humans, and not further scripts. Get your scripts
together, it's not that hard.

But if even the human is tired of **cod** constantly printing paths, the
environment variable **$COD_NONAME** may be set to *1* in order to silence it.


# no pix no clix?

Expand Down
12 changes: 9 additions & 3 deletions cod
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,21 @@
#SOFTWARE.

if [ "$#" = 0 ]; then
echo "$(pwd):"
if ! [ "${COD_NONAME}" = 1 ]; then
echo "$(pwd):"
fi
ls -Al
fi
for arg in "$@"; do
if [ -f "${arg}" ]; then
echo "${arg}:"
if ! [ "${COD_NONAME}" = 1 ]; then
echo "${arg}:"
fi
cat -- "${arg}"
elif [ -d "${arg}" ]; then
echo "${arg}:"
if ! [ "${COD_NONAME}" = 1 ]; then
echo "${arg}:"
fi
ls -Al -- "${arg}"
fi
done

0 comments on commit 8fe613d

Please sign in to comment.