Skip to content

Commit

Permalink
Refactoring and smaller updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
interkosmos committed Oct 12, 2024
1 parent c4b0466 commit ac2778e
Show file tree
Hide file tree
Showing 21 changed files with 597 additions and 368 deletions.
29 changes: 21 additions & 8 deletions adoc/dmbot.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,31 @@ All commands start with prefix `!`. For an overview, send chat command `!help`
to the bot. The following commands are supported:

!beats::
Returns current time of the sensor node in Swatch Internet Time.
Return current time of the sensor node in Swatch Internet Time.
!date::
Returns date and time of the sensor node in ISO 8601.
Return date and time of the sensor node in ISO 8601.
!help::
Returns help text.
Return help text.
!jid::
Return full JID of bot.
!log <level> "<message>"::
Send log message of given level to logger. The argument `level` must be a
valid log level name or numeric log level. The argument `message` must be in
quotes.
!node::
Return node id of bot.
!poke::
Returns a message if the bot is online.
Return status message if bot is online.
!reconnect::
Reconnects bot and updates local roster list.
Reconnect bot and update local roster list.
!roster::
Returns list of authorised users from the roster.
Return list of authorised users from the roster.
!uname::
Returns name and version of the operating system.
Return name and version of the operating system.
!uptime::
Returns uptime of the operating system
Return uptime of the operating system
!version::
Return bot version.

Update the list of authorised users by adding them to the roster of the bot and
sending command `!reconnect` afterwards. The bot will update the local roster
Expand Down Expand Up @@ -89,6 +99,9 @@ for testing.
*--port*, *-q* _port_::
Port of XMPP server. The default port is 5222.

*--reconnect*, *-R*::
Reconnect on error.

*--tls*, *-E*::
Force TLS encryption.

Expand Down
4 changes: 2 additions & 2 deletions app/dmbackup.f90
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ integer function read_args(app) result(rc)
type(arg_type) :: args(5)

args = [ &
arg_type('database', short='d', type=ARG_TYPE_DB, required=.true.), & ! -d, --database <path>
arg_type('backup', short='b', type=ARG_TYPE_STRING, required=.true.), & ! -b, --backup <path>
arg_type('database', short='d', type=ARG_TYPE_DATABASE, required=.true.), & ! -d, --database <path>
arg_type('backup', short='b', type=ARG_TYPE_STRING, required=.true.), & ! -b, --backup <path>
arg_type('vacuum', short='U', type=ARG_TYPE_LOGICAL), & ! -U, --vacuum
arg_type('wal', short='W', type=ARG_TYPE_LOGICAL), & ! -W, --wal
arg_type('verbose', short='V', type=ARG_TYPE_LOGICAL) & ! -V, --verbose
Expand Down
472 changes: 303 additions & 169 deletions app/dmbot.f90

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions app/dmdb.f90
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,14 @@ integer function read_args(app) result(rc)

! Required and optional command-line arguments.
args = [ &
arg_type('name', short='n', type=ARG_TYPE_ID), & ! -n, --name <id>
arg_type('config', short='c', type=ARG_TYPE_FILE), & ! -c, --config <path>
arg_type('logger', short='l', type=ARG_TYPE_ID), & ! -l, --logger <id>
arg_type('database', short='d', type=ARG_TYPE_DB), & ! -d, --database <path>
arg_type('node', short='N', type=ARG_TYPE_ID), & ! -N, --node <id>
arg_type('debug', short='D', type=ARG_TYPE_LOGICAL), & ! -D, --debug
arg_type('ipc', short='Q', type=ARG_TYPE_LOGICAL), & ! -Q, --ipc
arg_type('verbose', short='V', type=ARG_TYPE_LOGICAL) & ! -V, --verbose
arg_type('name', short='n', type=ARG_TYPE_ID), & ! -n, --name <id>
arg_type('config', short='c', type=ARG_TYPE_FILE), & ! -c, --config <path>
arg_type('logger', short='l', type=ARG_TYPE_ID), & ! -l, --logger <id>
arg_type('database', short='d', type=ARG_TYPE_DATABASE), & ! -d, --database <path>
arg_type('node', short='N', type=ARG_TYPE_ID), & ! -N, --node <id>
arg_type('debug', short='D', type=ARG_TYPE_LOGICAL), & ! -D, --debug
arg_type('ipc', short='Q', type=ARG_TYPE_LOGICAL), & ! -Q, --ipc
arg_type('verbose', short='V', type=ARG_TYPE_LOGICAL) & ! -V, --verbose
]

! Read all command-line arguments.
Expand Down
4 changes: 2 additions & 2 deletions app/dmdbctl.f90
Original file line number Diff line number Diff line change
Expand Up @@ -406,8 +406,8 @@ integer function read_args(app) result(rc)
arg_type('read', short='R', type=ARG_TYPE_STRING), & ! -R, --read <type>
arg_type('update', short='U', type=ARG_TYPE_STRING), & ! -U, --update <type>
arg_type('delete', short='D', type=ARG_TYPE_STRING), & ! -D, --delete <type>
arg_type('database', short='d', type=ARG_TYPE_DB, required=.true.), & ! -d, --database <path>
arg_type('id', short='I', type=ARG_TYPE_ID, required=.true.), & ! -I, --id <id>
arg_type('database', short='d', type=ARG_TYPE_DATABASE, required=.true.), & ! -d, --database <path>
arg_type('id', short='I', type=ARG_TYPE_ID, required=.true.), & ! -I, --id <id>
arg_type('name', short='n', type=ARG_TYPE_STRING, max_len=NODE_NAME_LEN), & ! -n, --name <string>
arg_type('meta', short='M', type=ARG_TYPE_STRING, max_len=NODE_META_LEN), & ! -M, --meta <string>
arg_type('node', short='N', type=ARG_TYPE_ID), & ! -N, --node <id>
Expand Down
18 changes: 9 additions & 9 deletions app/dmexport.f90
Original file line number Diff line number Diff line change
Expand Up @@ -188,18 +188,18 @@ integer function read_args(app) result(rc)
type(arg_type) :: args(12)

args = [ &
arg_type('database', short='d', type=ARG_TYPE_DB, required=.true.), & ! -d, --database <path>
arg_type('output', short='o', type=ARG_TYPE_STRING), & ! -o, --output <path>
arg_type('node', short='N', type=ARG_TYPE_ID), & ! -N, --node <id>
arg_type('sensor', short='S', type=ARG_TYPE_ID), & ! -S, --sensor <id>
arg_type('target', short='T', type=ARG_TYPE_ID), & ! -T, --target <id>
arg_type('from', short='B', type=ARG_TYPE_TIME), & ! -F, --from <timestamp>
arg_type('to', short='E', type=ARG_TYPE_TIME), & ! -T, --to <timestamp>
arg_type('database', short='d', type=ARG_TYPE_DATABASE, required=.true.), & ! -d, --database <path>
arg_type('output', short='o', type=ARG_TYPE_STRING), & ! -o, --output <path>
arg_type('node', short='N', type=ARG_TYPE_ID), & ! -N, --node <id>
arg_type('sensor', short='S', type=ARG_TYPE_ID), & ! -S, --sensor <id>
arg_type('target', short='T', type=ARG_TYPE_ID), & ! -T, --target <id>
arg_type('from', short='B', type=ARG_TYPE_TIME), & ! -F, --from <timestamp>
arg_type('to', short='E', type=ARG_TYPE_TIME), & ! -T, --to <timestamp>
arg_type('response', short='R', type=ARG_TYPE_ID, max_len=RESPONSE_NAME_LEN), & ! -R, --response <name>
arg_type('format', short='f', type=ARG_TYPE_STRING, max_len=FORMAT_NAME_LEN, required=.true.), & ! -f, --format <string>
arg_type('type', short='t', type=ARG_TYPE_STRING, max_len=TYPE_NAME_LEN, required=.true.), & ! -t, --type <string>
arg_type('header', short='H', type=ARG_TYPE_LOGICAL), & ! -H, --header
arg_type('separator', short='s', type=ARG_TYPE_CHAR) & ! -a, --separator <char>
arg_type('header', short='H', type=ARG_TYPE_LOGICAL), & ! -H, --header
arg_type('separator', short='s', type=ARG_TYPE_CHAR) & ! -a, --separator <char>
]

! Read all command-line arguments.
Expand Down
32 changes: 16 additions & 16 deletions app/dmfeed.f90
Original file line number Diff line number Diff line change
Expand Up @@ -81,22 +81,22 @@ integer function read_args(app) result(rc)
type(arg_type) :: args(16)

args = [ &
arg_type('name', short='n', type=ARG_TYPE_ID), & ! -n, --name <id>
arg_type('config', short='c', type=ARG_TYPE_FILE), & ! -c, --config <path>
arg_type('database', short='d', type=ARG_TYPE_DB), & ! -d, --database <path>
arg_type('output', short='o', type=ARG_TYPE_STRING), & ! -o, --output <path>
arg_type('node', short='N', type=ARG_TYPE_ID), & ! -N, --node <id>
arg_type('entries', short='E', type=ARG_TYPE_INTEGER), & ! -E, --entries <n>
arg_type('minlevel', short='L', type=ARG_TYPE_LEVEL), & ! -L, --minlevel <n>
arg_type('maxlevel', short='K', type=ARG_TYPE_LEVEL), & ! -K, --maxlevel <n>
arg_type('force', short='F', type=ARG_TYPE_LOGICAL), & ! -F, --force
arg_type('author', short='A', type=ARG_TYPE_STRING), & ! -A, --author <string>
arg_type('email', short='M', type=ARG_TYPE_STRING), & ! -M, --email <string>
arg_type('id', short='I', type=ARG_TYPE_STRING), & ! -I, --id <string>
arg_type('title', short='C', type=ARG_TYPE_STRING), & ! -C, --title <string>
arg_type('subtitle', short='G', type=ARG_TYPE_STRING), & ! -G, --subtitle <string>
arg_type('url', short='U', type=ARG_TYPE_STRING), & ! -U, --url <string>
arg_type('xsl', short='X', type=ARG_TYPE_STRING) & ! -X, --xsl <string>
arg_type('name', short='n', type=ARG_TYPE_ID), & ! -n, --name <id>
arg_type('config', short='c', type=ARG_TYPE_FILE), & ! -c, --config <path>
arg_type('database', short='d', type=ARG_TYPE_DATABASE), & ! -d, --database <path>
arg_type('output', short='o', type=ARG_TYPE_STRING), & ! -o, --output <path>
arg_type('node', short='N', type=ARG_TYPE_ID), & ! -N, --node <id>
arg_type('entries', short='E', type=ARG_TYPE_INTEGER), & ! -E, --entries <n>
arg_type('minlevel', short='L', type=ARG_TYPE_LEVEL), & ! -L, --minlevel <n>
arg_type('maxlevel', short='K', type=ARG_TYPE_LEVEL), & ! -K, --maxlevel <n>
arg_type('force', short='F', type=ARG_TYPE_LOGICAL), & ! -F, --force
arg_type('author', short='A', type=ARG_TYPE_STRING), & ! -A, --author <string>
arg_type('email', short='M', type=ARG_TYPE_STRING), & ! -M, --email <string>
arg_type('id', short='I', type=ARG_TYPE_STRING), & ! -I, --id <string>
arg_type('title', short='C', type=ARG_TYPE_STRING), & ! -C, --title <string>
arg_type('subtitle', short='G', type=ARG_TYPE_STRING), & ! -G, --subtitle <string>
arg_type('url', short='U', type=ARG_TYPE_STRING), & ! -U, --url <string>
arg_type('xsl', short='X', type=ARG_TYPE_STRING) & ! -X, --xsl <string>
]

! Read all command-line arguments.
Expand Down
2 changes: 1 addition & 1 deletion app/dmimport.f90
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ integer function read_args(app) result(rc)

args = [ &
arg_type('type', short='t', type=ARG_TYPE_STRING, max_len=TYPE_NAME_LEN, required=.true.), & ! -t, --type <string>
arg_type('database', short='d', type=ARG_TYPE_DB), & ! -d, --database <path>
arg_type('database', short='d', type=ARG_TYPE_DATABASE), & ! -d, --database <path>
arg_type('input', short='i', type=ARG_TYPE_STRING, required=.true.), & ! -i, --input <path>
arg_type('quote', short='q', type=ARG_TYPE_CHAR), & ! -q, --quote <char>
arg_type('separator', short='s', type=ARG_TYPE_CHAR), & ! -s, --separator <char>
Expand Down
2 changes: 1 addition & 1 deletion app/dminfo.f90
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ integer function read_args(app) result(rc)
type(arg_type) :: args(1)

args = [ &
arg_type(name='database', short='d', type=ARG_TYPE_DB) & ! -d, --database <path>
arg_type(name='database', short='d', type=ARG_TYPE_DATABASE) & ! -d, --database <path>
]

rc = dm_arg_read(args, APP_NAME, APP_MAJOR, APP_MINOR, APP_PATCH, dm_db_version(.true.))
Expand Down
14 changes: 7 additions & 7 deletions app/dmlogger.f90
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,13 @@ integer function read_args(app) result(rc)

! Required and optional command-line arguments.
args = [ &
arg_type('name', short='n', type=ARG_TYPE_ID), & ! -n, --name <id>
arg_type('config', short='c', type=ARG_TYPE_FILE), & ! -c, --config <path>
arg_type('database', short='d', type=ARG_TYPE_DB), & ! -d, --database <path>
arg_type('node', short='N', type=ARG_TYPE_ID), & ! -N, --node <id>
arg_type('minlevel', short='L', type=ARG_TYPE_LEVEL), & ! -L, --minlevel <n>
arg_type('ipc', short='Q', type=ARG_TYPE_LOGICAL), & ! -Q, --ipc
arg_type('verbose', short='V', type=ARG_TYPE_LOGICAL) & ! -V, --verbose
arg_type('name', short='n', type=ARG_TYPE_ID), & ! -n, --name <id>
arg_type('config', short='c', type=ARG_TYPE_FILE), & ! -c, --config <path>
arg_type('database', short='d', type=ARG_TYPE_DATABASE), & ! -d, --database <path>
arg_type('node', short='N', type=ARG_TYPE_ID), & ! -N, --node <id>
arg_type('minlevel', short='L', type=ARG_TYPE_LEVEL), & ! -L, --minlevel <n>
arg_type('ipc', short='Q', type=ARG_TYPE_LOGICAL), & ! -Q, --ipc
arg_type('verbose', short='V', type=ARG_TYPE_LOGICAL) & ! -V, --verbose
]

! Read all command-line arguments.
Expand Down
30 changes: 15 additions & 15 deletions app/dmplot.f90
Original file line number Diff line number Diff line change
Expand Up @@ -125,23 +125,23 @@ integer function read_args(app) result(rc)
type(arg_type) :: args(17)

args = [ &
arg_type('name', short='n', type=ARG_TYPE_ID), & ! -n, --name <string>
arg_type('config', short='c', type=ARG_TYPE_FILE), & ! -c, --config <path>
arg_type('database', short='d', type=ARG_TYPE_DB), & ! -d, --database <file>
arg_type('node', short='N', type=ARG_TYPE_ID), & ! -N, --node <id>
arg_type('sensor', short='S', type=ARG_TYPE_ID), & ! -S, --sensor <id>
arg_type('target', short='T', type=ARG_TYPE_ID), & ! -T, --target <id>
arg_type('name', short='n', type=ARG_TYPE_ID), & ! -n, --name <string>
arg_type('config', short='c', type=ARG_TYPE_FILE), & ! -c, --config <path>
arg_type('database', short='d', type=ARG_TYPE_DATABASE), & ! -d, --database <file>
arg_type('node', short='N', type=ARG_TYPE_ID), & ! -N, --node <id>
arg_type('sensor', short='S', type=ARG_TYPE_ID), & ! -S, --sensor <id>
arg_type('target', short='T', type=ARG_TYPE_ID), & ! -T, --target <id>
arg_type('response', short='R', type=ARG_TYPE_ID, max_len=RESPONSE_NAME_LEN), & ! -R, --response <name>
arg_type('from', short='B', type=ARG_TYPE_TIME), & ! -B, --from <timestamp>
arg_type('to', short='E', type=ARG_TYPE_TIME), & ! -E, --to <timestamp>
arg_type('from', short='B', type=ARG_TYPE_TIME), & ! -B, --from <timestamp>
arg_type('to', short='E', type=ARG_TYPE_TIME), & ! -E, --to <timestamp>
arg_type('terminal', short='m', type=ARG_TYPE_STRING, max_len=PLOT_TERMINAL_NAME_LEN), & ! -m, --terminal <name>
arg_type('output', short='o', type=ARG_TYPE_STRING), & ! -o, --output <file>
arg_type('background', short='G', type=ARG_TYPE_STRING), & ! -G, --background <color>
arg_type('foreground', short='P', type=ARG_TYPE_STRING), & ! -P, --foreground <color>
arg_type('font', short='A', type=ARG_TYPE_STRING), & ! -A, --font <name>
arg_type('title', short='C', type=ARG_TYPE_STRING), & ! -C, --title <title>
arg_type('width', short='W', type=ARG_TYPE_INTEGER), & ! -W, --width <n>
arg_type('height', short='H', type=ARG_TYPE_INTEGER) & ! -H, --height <n>
arg_type('output', short='o', type=ARG_TYPE_STRING), & ! -o, --output <file>
arg_type('background', short='G', type=ARG_TYPE_STRING), & ! -G, --background <color>
arg_type('foreground', short='P', type=ARG_TYPE_STRING), & ! -P, --foreground <color>
arg_type('font', short='A', type=ARG_TYPE_STRING), & ! -A, --font <name>
arg_type('title', short='C', type=ARG_TYPE_STRING), & ! -C, --title <title>
arg_type('width', short='W', type=ARG_TYPE_INTEGER), & ! -W, --width <n>
arg_type('height', short='H', type=ARG_TYPE_INTEGER) & ! -H, --height <n>
]

! Create version string and search for Gnuplot.
Expand Down
Loading

0 comments on commit ac2778e

Please sign in to comment.