Compare commits

4 Commits

Author SHA1 Message Date
Phani Pavan K
0edc8467fd implement pylist, fixes #2
Some checks failed
/ Lint Check Shellscripts (push) Failing after 32s
2026-02-06 12:50:27 +05:30
Phani Pavan K
a8ecdb60a5 fixed #1 and stderr perm issue
All checks were successful
/ Lint Check Shellscripts (push) Successful in 16s
2026-01-13 20:58:20 +05:30
Phani Pavan K
928e8b2d2d added small commands, lowercasing env names
All checks were successful
/ Lint Check Shellscripts (push) Successful in 13s
2026-01-13 20:47:10 +05:30
eb96776e3c Merge pull request 'jbomb-automate' (#4) from jbomb-automate into master
All checks were successful
/ Lint Check Shellscripts (push) Successful in 11s
Reviewed-on: #4
2026-01-13 15:03:35 +00:00
2 changed files with 17 additions and 7 deletions

4
jconf
View File

@@ -47,7 +47,7 @@ fi
cmd=$1
case "$cmd" in
adduser)
adduser|mku)
USER=$(echo "$2" | tr "[:upper:]" "[:lower:]")
exist=$(awk -F: -v username="$USER" '{if ($1 == username && $3 >= 1000 && $1 != "nobody") {print 1; found=1; exit}} END {if (!found) print 0}' /etc/passwd)
if [ "$exist" -eq 1 ]; then
@@ -71,7 +71,7 @@ case "$cmd" in
fi
exit 1
;;
deluser)
deluser|rmu)
USER=$(echo "$2" | tr "[:upper:]" "[:lower:]")
exist=$(awk -F: -v username="$USER" '{if ($1 == username && $3 >= 1000 && $1 != "nobody") {print 1; found=1; exit}} END {if (!found) print 0}' /etc/passwd)
if [ "$exist" -eq 0 ]; then

20
penv Normal file → Executable file
View File

@@ -19,6 +19,7 @@ usage() {
# echo " - setdef <name> - Use an existing environment as the default kernel"
echo " - activate <name> - Activates an existing environment (depricated, use pact)"
echo " - list - List available environments"
echo " - pylist - List available PYTHON versions"
echo " - install - Initialize user's profile"
echo " - uninstall - Remove ALL the environments installed using PENV"
echo " - help - Print this message"
@@ -28,6 +29,7 @@ usage() {
echo " - del -> rm"
# echo " - setdef -> sd"
echo " - activate -> ac, act"
echo " - pylist -> pyls"
echo " - list -> ls"
}
@@ -62,8 +64,8 @@ create(){
mkdir -p "$HOME"/.envs
/usr/bin/python"$vers" -m venv "$HOME"/.envs/"$name"
source "$HOME"/.envs/"$name"/bin/activate
python -m pip install ipykernel ipywidgets > /dev/stderr
python -m ipykernel install --user --name "$name" > /dev/stderr
python -m pip install ipykernel ipywidgets
python -m ipykernel install --user --name "$name"
echo
echo "Created \"$name\". It should be available as a Jupyter Kernel."
echo "Use \"pact $name\" to activate in command line."
@@ -130,6 +132,7 @@ install() {
echo PENV already installed
exit 10
fi
mkdir -p "$HOME/.local/bin"
cp $(realpath "$0") "$HOME"/.local/bin/
mkdir -p "$HOME"/.envs/
echo "
@@ -176,6 +179,10 @@ uninstall() {
echo "Uninstalled PENV"
}
pyls(){
ls /usr/bin/python3.* /usr/local/bin/python3.* 2> /dev/null | tr " " "\n" | grep "3.*" --color=always
}
if [ "$#" -lt 1 ]; then
title
usage
@@ -186,20 +193,23 @@ cmd=$1
case "$cmd" in
new|mk)
create "$2" "$3"
create "$(echo "$2" | tr "[:upper:]" "[:lower:]")" "$3"
;;
del|rm)
delete "$2"
delete "$(echo "$2" | tr "[:upper:]" "[:lower:]")"
;;
# setdef|sd)
# setdef $2
# ;;
act|ac)
activate "$2"
activate "$(echo "$2" | tr "[:upper:]" "[:lower:]")"
;;
list|ls)
list
;;
pylist|pyls)
pyls
;;
help)
title
usage