Permalink
Browse files

Added more API comments.

  • Loading branch information...
1 parent c3fadbd commit 25836e8ad93c38ea26f284718c145823596a8040 @wayneeseguin wayneeseguin committed Oct 18, 2011
View
36 core/api/shell/array/functions
@@ -6,24 +6,26 @@
# API Version: 1.0.0
#
# array {command} {params...}
+#
# where command is one of:
-# is
-# empty
-# nonempty
-# even
-# last
-# first
-# push
-# pop
-# append
-# shift
-# unshift
-# join
-# largest
-# sort
-# desc
-# asc
-# unique
+#
+# is empty
+# is nonempty
+# is even
+# length
+# last
+# first
+# push
+# pop
+# append
+# shift
+# unshift
+# join
+# largest
+# sort desc
+# sort asc
+# unique
+# start # index of first element
#
array()
View
12 core/api/shell/command/functions
@@ -1,5 +1,17 @@
#!/bin/sh
+#
+# SM command API
+#
+# command exists {name}
+# command is function {name}
+# command is script {name} # NIY
+# command is binary {name} # NIY
+# command full name {name}
+# command run "command to run"
+# command run as {username} "command to run"
+# command "command" # calls shell builtin 'command'.
+#
command() { commands "$@" ; }
commands()
View
7 core/api/shell/config/functions
@@ -1,6 +1,11 @@
#!/bin/sh
-
+#
+# SM config API
+#
+# config read key {key} file {file} [<into|as> {variable}] [prefix {prefix}]
+# config write key {key} value {value} file {file}
+#
config()
{
trace_filter config || set -o xtrace
View
5 core/api/shell/database/functions
@@ -1,5 +1,10 @@
#!/bin/sh
+database()
+{
+ :
+}
+
api_database_initialize()
{
if user is root
View
23 core/api/shell/date/functions → core/api/shell/dates/functions
@@ -1,6 +1,13 @@
#!/bin/sh
-date()
+#
+# SM date module API
+#
+# dates start {date} end {date} [step {step}] [format "%Y-%m-%dT%H:%I:%S]
+#
+# where {step} is one of {minute,hour,day,week,month,year}
+#
+dates()
{
true ${date_format:="%Y-%m-%dT%H:%M:%S"}
@@ -51,25 +58,25 @@ date()
[[ -n "${_end}" ]] || __sm.log.fail "end date must be specified."
case "${_step}" in
- minute)
+ (minute)
_minute=60
;;
- hour)
+ (hour)
_step=3600
;;
- day)
+ (day)
_step=86400
;;
- week)
+ (week)
_step=604800
;;
- month)
+ (month)
_step=2629743
;;
- year)
+ (year)
_step=31556926
;;
- *)
+ (*)
__sm.log.fail "Unknown step token ${1:-};"\
" valid steps are {minute,hour,day,week,month,year}."
;;
View
36 core/api/shell/files/functions
@@ -9,6 +9,41 @@
#
# TODO: Finish this API documentation below
#
+# file exists {file}
+# files exist {file}
+# file is empty {file}
+# files are nonempty {file}
+# file is executable {file}
+# files are executable {file}
+# file is symlink {file}
+# files are symlinks {file}
+# file absolute path {file}
+# file sha 256 {file}
+# file sha 512 {file}
+# file change owner {owner} {file}
+# file chown {mode} {file}
+# files chown {mode} {files}
+# file change permissions {mode} {file}
+# files change permissions {mode} {files}
+# file chmod {mode} {file}
+# files chmod {mode} {files}
+# files change permissions
+# file append to {file} content {content}
+# file copy from {source} to {target}
+# file move from {source} to {target}
+# file link symbolic force from {source} to {target}
+# file replace regex {regex} with {content} in {file}
+# file open {file}
+# file md5 {file}
+# file(s) expand {file}
+# file search {file} # NIY
+# file(s) source {file}
+# file remove {file}
+# file create {file}
+# file touch {file}
+# files touch {files}
+# files within {path}
+# files in {path}
file() { files "$@" ; }
files()
@@ -29,6 +64,7 @@ files()
"sha 256"
"sha 512"
"change owner to=chown"
+ "change permissions to=chmod"
"change rights to=chmod"
)
View
6 core/api/shell/hash/functions
@@ -1,12 +1,12 @@
#!/bin/sh
#
-# # Hash in file Module
+# NOTE: hash() is merged into the config module API, do not use hash api as it
+# will be removed.
#
# Allows manipulation of multiline values and keyss containing - and \.
#
-
-# TODO: Replace hash() with zsh mapfiles / internal constructs merge into config.
+# TODO: Remove hash() with zsh mapfiles / internal constructs merge into config.
hash()
{
typeset _token _file _keys _valid_keys
View
6 core/api/shell/interactive/functions
@@ -1,5 +1,11 @@
#!/bin/sh
+#
+# SM shell API
+#
+# shell is interactive
+#
+#
shell()
{
typeset _token
View
11 core/api/shell/os/functions
@@ -9,6 +9,17 @@
#
# TODO: Finish this API documentation below
#
+# os is <linux|darwin|bsd|solaris|aix>
+# os cpu count
+# os open {uri}
+# os type
+# os version
+# os version major
+# os version minor
+# os version patch
+# os arch
+# os arch capable
+#
os()
{
trace_filter os || set -o xtrace
View
25 core/api/shell/service/functions
@@ -7,6 +7,31 @@
# TODO: Rework this into a 1.0.0 module API
# Public API for managing and working with a single service.
# This is what is used by service extensions.
+#
+# service start
+# service stop
+# service restart
+# service reload
+# service restart
+# service setup
+# service status
+# service info
+# service logtail
+# service list
+# service configcheck
+# service usage
+# service cli
+# service setup
+# service uninstall
+# service pid
+# service confd
+# service initd
+# service activate
+# service deactivate
+# service status
+# service signal
+# service initialize
+#
service()
{
trace_filter service || set -o xtrace
View
5 core/api/shell/string/functions
@@ -4,6 +4,11 @@
# SM Framework Core Module ~ String (string)
#
+#
+# string contains {string} {content}
+# string append ...
+# string prepend ...
+#
string()
{
typeset _token _command _string _search _regex
View
16 core/api/shell/templates/functions
@@ -3,16 +3,16 @@
# TODO: Rework this into a 1.0.0 module API
#
-# user$ templates install "nginx.conf" \
-# to "${nginx_path}/nginx.conf" \
-# mode 0644 owner "${nginx_user}"
+# user$ templates install "nginx.conf" \
+# to "${nginx_path}/nginx.conf" \
+# mode 0644 owner "${nginx_user}"
#
# user$ templates seed "/etc/conf.d/${extension}.conf" \
-# prefix_path "${prefix_path}" \
-# init_scripts_path "${init_scripts_path}" \
-# data_path "${data_path}" \
-# confd_path "${confd_path}" \
-# extension "${extension}"
+# prefix_path "${prefix_path}" \
+# init_scripts_path "${init_scripts_path}" \
+# data_path "${data_path}" \
+# confd_path "${confd_path}" \
+# extension "${extension}"
#
# Note that if you wish to eliminate all unset strings, pass the pair
# ".*" ""
View
3 core/api/shell/traps/functions
@@ -1,5 +1,8 @@
#!/bin/sh
+#
+# traps on exit "command"
+#
traps()
{
typeset _token _signal _code __traps_code
View
11 core/api/shell/user/functions
@@ -1,5 +1,16 @@
#!/bin/sh
+#
+# user is root user {username}
+# user is not root user {username}
+# user is privileged user {username}
+# user is unprivileged user {username}
+# user set home {home} for {username}
+# user set shell {shell} for {username}
+# user create unless exists name {username}
+# user exists name {username}
+#
+
user()
{
trace_filter users || set -o xtrace
View
8 core/api/shell/variables/functions
@@ -1,5 +1,13 @@
#!/bin/sh
+#
+# variable is empty {variable}
+# variable is nonempty {variable}
+# variables are empty {variables}
+# variables are nonempty {variables}
+# variables must be empty {variables}
+# variables must be nonempty {variables}
+#
variable() { variables "$@"; }
variables()
View
3 install
@@ -4,8 +4,7 @@ extension_args=()
while (( $# ))
do
- token="$1"
- shift
+ token="$1" && shift
case "$token" in
(--trace|trace)
extension_args+=("--trace=all")

0 comments on commit 25836e8

Please sign in to comment.