@@ -68,15 +68,16 @@ if [[ ! -d $FPKGDIR ]]; then
6868
6969 if [[ $choice != " n" ]]; then # so that the default is "yes"
7070 mkdir -pv $FPKGDIR /ii # create the ii one too already
71+ cp .bashrc $FPKGDIR # and copy .bashrc to the main dir
7172 fi
7273
7374 quit 1
7475fi
7576
76- # hide keystrokes, save current directory to go to $FPKGDIR
77- stty -echo
78- pushd . > /dev/null
79- cd $FPKGDIR
77+ # environment setup
78+ stty -echo # hide keystrokes, note that they still get registered
79+ pushd . > /dev/null # save user's current directory
80+ cd $FPKGDIR # so that we can go to $FPKGDIR
8081
8182case $1 in
8283 # refresh the packages with `git pull'
@@ -91,7 +92,7 @@ case $1 in
9192
9293 if [[ $? != 0 ]]; then
9394 error " $pkg_dir does not exist! Remove its entry
94- with 'fpkg delete' and try again. Aborting..."
95+ with 'fpkg delete' and try again. Aborting..."
9596 fi
9697
9798 echo " $pkg_dir :"
@@ -100,7 +101,7 @@ case $1 in
100101 # refreshing just a single package?
101102 else
102103 exist_check $2 # check if it exists first
103- cd $2 # change to its directory then
104+ cd $2 # change to its directory if so
104105 update $2 # and perform the update
105106 fi
106107 ;;
@@ -164,13 +165,21 @@ case $1 in
164165 echo $2 >> pkg.list
165166
166167 # write a template for it to make it easier for the user
167- # i couldn't get a single call to echo to work so i had to
168- # come up with this
169- echo " # Installation instructions for package $2 " > ii/$2 .ii
168+ # i couldn't get this to work by using a single call to
169+ # echo so i came up with this
170+ echo " # - Installation instructions for package $2 - " > ii/$2 .ii
170171 echo " # Inside install (), write the commands for" >> ii/$2 .ii
171172 echo " # installing the package," >> ii/$2 .ii
172173 echo " # and inside remove (), write the commands for" >> ii/$2 .ii
173174 echo -e " # uninstalling it too." \\ n\\ n >> ii/$2 .ii
175+
176+ # write a commented out privilege check section so that if
177+ # there're any steps requiring elevated privileges a check
178+ # is made for it
179+ echo -e " #if [[ \$ (id -u) != 0 ]]; then" >> ii/$2 .ii
180+ echo -e " #\\ techo \" This action requires root privileges!\" " >> ii/$2 .ii
181+ echo -e " #\\ texit 1" >> ii/$2 .ii
182+ echo -e " #fi" \\ n >> ii/$2 .ii
174183
175184 echo -e " install () {" \\ n\\ n" }" \\ n >> ii/$2 .ii
176185 echo -e " remove () {" \\ n\\ n" }" \\ n >> ii/$2 .ii
@@ -211,7 +220,7 @@ case $1 in
211220
212221 sh -c ' cd $FPKGDIR/$PKG_DIR; # change to the directory
213222 echo "Working on $PKG_DIR/, ^D to exit"; # make the user aware of it
214- exec bash --rcfile $FPKGDIR/.bashrc' # and here it goes
223+ exec bash --rcfile $FPKGDIR/.bashrc' # and here it goes
215224 ;;
216225
217226 # editing a package's .ii?
@@ -237,9 +246,7 @@ case $1 in
237246 read choice
238247
239248 if [[ $choice = ' y' ]]; then # same thing but with "no"
240- echo " Package directory (relative to $FPKGDIR ):"
241- read dir
242- rm -rf $dir
249+ rm -rf $2
243250 fi
244251 ;;
245252
@@ -256,7 +263,7 @@ case $1 in
256263 if [[ $1 = " -d" ]]; then
257264 git show
258265 else
259- git --no-pager log -1 --pretty=" %s : %b"
266+ git --no-pager log -1 --pretty=" Who: %cn%nWhat: %s%nDetails : %b"
260267 fi
261268 ;;
262269
@@ -266,7 +273,7 @@ case $1 in
266273 # is a number
267274 number_check=" ^[0-9]+$"
268275
269- # shift then
276+ # shift if it is
270277 if [[ $2 =~ $number_check ]]; then
271278 shift
272279 fi
@@ -281,12 +288,12 @@ case $1 in
281288 DEPTH=5
282289 fi
283290
284- git --no-pager log -$DEPTH --pretty=" (%cd) %s: %b"
291+ git --no-pager log -$DEPTH --pretty=" (%cd)%nWho: %cn%nWhat: %s%n %b"
285292 ;;
286293
287294 # requested the version?
288295 " version" | " v" )
289- echo " fpkg - version 3.0.0-beta1 "
296+ echo " fpkg - version 3.0.0-beta2 "
290297 echo " ruby R53 (https://github.com/ruby-R53), May 2024"
291298 ;;
292299
@@ -309,7 +316,7 @@ case $1 in
309316 echo " message | m [-d] <pkg> - get comment from last commit of <pkg>. Takes an"
310317 echo " optional -d for getting its diff"
311318 echo " history | H [n] <pkg> - get <pkg>'s commit history. Takes an optional"
312- echo " [n] to get a custom depth. Default is $DEPTH "
319+ echo " [n] to get a custom depth. Defaults to 5 "
313320 echo " version | v - get fpkg's version"
314321
315322 # exit with error if input wasn't
0 commit comments