Open dimo414 opened 8 years ago
Original comment by Michael Diamond (Bitbucket: dimo414).
There are really a couple different namespaces to support:
__pgem::
: truly private, used only internally by ProfileGem (e.g. the functions in privateGemFunctions.sh
and other helpers)_pgem_
: Utility functions intended to be used by gemspgem_
: User-facing functions intended to be called interactivelyOriginal comment by Michael Diamond (Bitbucket: dimo414).
Gems should also have standard namespaces:
__foo_gem::
for foo.gem's private fields_foo_gem_
for fields that will be accessed by other gemsOriginal comment by Michael Diamond (Bitbucket: dimo414).
Different plan, along the lines of bash-cache:
pg::_foo
for private helper functionspg::foo
for non-interactive functions such as those used by gemspgem_foo
for user-facing functionsGems should similarly use a bar::
namespace (where "bar" is the name of the gem) for non-user-facing functions.
NB pg
is a standard Unix command, so pg
shouldn't be used directly.
Original report by Michael Diamond (Bitbucket: dimo414).
Reference https://google.github.io/styleguide/shell.xml
The Google Style Guide suggests using
::
to delimit function namespaces, but that prevents tab-completion¹ (perhaps that's an advantage?)..
seems to be a common choice which does enable tab-completion.¹ See Bash FAQ E13 and https://stackoverflow.com/a/12495727