Skip to content

Commit

Permalink
fix too many underscores prepension with r_smart_file_downcase_identi…
Browse files Browse the repository at this point in the history
…fier

* new commands eval and r-eval to quickly test a function without having to create a mulle-bashfunctions script
* new commnads embed-booter and extract-booter to just add zsh/bash booting functionality to anotherwise non mulle-bashfunctions script
  • Loading branch information
mulle-nat committed Jan 11, 2024
1 parent 87f425d commit f59f3ca
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 1 deletion.
13 changes: 13 additions & 0 deletions RELEASENOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
## 6.2.0

* new commands eval and r-eval to quickly test a function without having to create a mulle-bashfunctions script
* new commnads embed-booter and extract-booter to just add zsh/bash booting functionality to anotherwise non mulle-bashfunctions script
* somewhat improved tracing speed
* new function `r_smart_file_downcase_identifier` for C header shields for example e.g. #ifndef `foo_h__`
* bugfix for termux (android)
* improved mulle-bashfunctions embedding (and update/removal) to create standalone scripts that don't need mulle-bashfunctions installed
* fix `r_extensionless_filename`
* add --silent-but-warn flag as a `MULLE_FLAG_LOG_TERSE` option
* add `shell_is_builtin_command` function


## 6.1.0

* somewhat improved tracing speed
Expand Down
2 changes: 1 addition & 1 deletion mulle-bash
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ fi
# this is "our" version
# the actual loaded version may differ (and will change this variable)
#
MULLE_BASHFUNCTIONS_VERSION="6.1.0"
MULLE_BASHFUNCTIONS_VERSION="6.2.0"
MULLE_BASHFUNCTIONS_LIBEXEC_DIRNAME="libexec"
MULLE_EXECUTABLE="$1"

Expand Down
47 changes: 47 additions & 0 deletions mulle-bashfunctions
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ Usage:
* locate the "mulle-bashfunctions.sh" install path for a desired variant
* show documentation for any of the defined functions
* list the available libraries, which you can "include"
* run an arbitrary mulle-bashfunction with eval and r-eval

Examples:
Load "mulle-bashfunctions-all.sh" into the current interactive shell:
Expand All @@ -68,12 +69,14 @@ Commands:
apropos <f> : search for a function by keywords
embed : embed mulle-bashfunctions into a script
env : environment needed for "mulle-bashfunctions.sh"
eval <cmd> : evaluate cmd inside of mulle-bashfunctions
functions : list defined functions
hostname : show system hostname used by mulle-bashfunctions
libraries : list available libraries
load [variant] : use eval \`mulle-bashfunctions load\` to load
man <function> : show documention for function, if available
path [variant] : path to "mulle-bashfunctions.sh"
r-eval <cmd> : evaluate cmd inside of mulle-bashfunctions and print RVAL
username : show username used by mulle-bashfunctions
uname : show system short name used by mulle-bashfunctions
version : print currently used version
Expand Down Expand Up @@ -698,6 +701,9 @@ Usage:
A convenient place to place these marker sis right after the booter
(below MULLE_EXECUTABLE_VERSION if that line exists).

Use mulle-bashfunctions boot-embed/boot-extract, if you just want to add
or remove the boot code.

EOF
exit 1
}
Expand Down Expand Up @@ -971,6 +977,10 @@ main()
usage
;;

-f|--force)
MULLE_FLAG_MAGNUM_FORCE='YES'
;;

--version)
printf "%s\n" "${MULLE_BASHFUNCTIONS_VERSION}"
exit 0
Expand Down Expand Up @@ -1015,10 +1025,18 @@ MULLE_HOSTNAME=\"${MULLE_HOSTNAME}\"
MULLE_UNAME=\"${MULLE_UNAME}\""
;;

embed-boot)
mulle_boot_embed "$@"
;;

embed)
mulle_boot_embed "$@" | mulle_bashfunctions_embed "$@"
;;

extract-boot)
mulle_boot_extract "$@"
;;

extract|unembed)
mulle_boot_extract "$@" | mulle_bashfunctions_extract "$@"
;;
Expand Down Expand Up @@ -1082,6 +1100,35 @@ export MULLE_UNAME ;
echo "${MULLE_BASHFUNCTIONS_LIBEXEC_DIR}/mulle-bashfunctions${format}.sh"
;;

# useful for accessing a single function from the library
eval)
include "path"
include "file"
include "case"
include "parallel"
include "sort"
include "url"
include "version"

"$@"
return $?
;;

# useful for accessing a r function from the library
r-eval)
include "path"
include "file"
include "case"
include "parallel"
include "sort"
include "url"
include "version"

"$@" || return $?
printf "%s\n" "${RVAL}"
return 0
;;

shell)
printf "%s\n" `ps -h -o cmd -p $$ | awk '{ print $1 }'`
;;
Expand Down
7 changes: 7 additions & 0 deletions src/mulle-case.sh
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,13 @@ function r_smart_file_downcase_identifier()

r_de_camel_case_identifier "$s"
r_lowercase "${RVAL}"

# this to have _MulleFoo not produce __mulle_foo but _mulle_foo
case "${s}" in
+(_)[A-Z]*)
RVAL="${RVAL#_}"
;;
esac
}


Expand Down

0 comments on commit f59f3ca

Please sign in to comment.