From 8a6ea479e2a4d4517d77ac41b9b75533f693a40c Mon Sep 17 00:00:00 2001 From: Aaron Fiore Date: Fri, 9 Aug 2024 23:44:38 -0700 Subject: [PATCH] client: plugins: docker: add example --- client/plugins/docker/example.bash | 81 ++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100755 client/plugins/docker/example.bash diff --git a/client/plugins/docker/example.bash b/client/plugins/docker/example.bash new file mode 100755 index 0000000..beb97a7 --- /dev/null +++ b/client/plugins/docker/example.bash @@ -0,0 +1,81 @@ +#!/usr/bin/env bash + +# docker-finance | modern accounting for the power-user +# +# Copyright (C) 2024 Aaron Fiore (Founder, Evergreen Crypto LLC) +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# +# Plugins +# +# The plugins path (this directory) is where you can place any executable. +# Any plugin found in this directory will be made available via the `plugins` command. +# +# Your plugin will have access to globals and functions provided by: +# +# - docker.bash +# - lib_docker.bash +# +# The following is an example of how to create your own plugin: +# + +# +# "Libraries" +# + +[ -z "$DOCKER_FINANCE_CLIENT_REPO" ] && exit 1 +source "${DOCKER_FINANCE_CLIENT_REPO}/client/src/docker/lib/lib_docker.bash" + +# Initialize "constructor" +lib_docker::docker "archlinux/${USER}:default" + +# +# Implementation +# + +function main() +{ + [ -z "$global_arg_delim_1" ] && exit 1 + [ -z "$global_arg_delim_2" ] && exit 1 + [ -z "$global_platform" ] && exit 1 + [ -z "$global_tag" ] && exit 1 + [ -z "$global_user" ] && exit 1 + + echo -e " +This clients's environment: + +$(printenv | grep ^DOCKER_FINANCE | sort) + +This plugin's caller image: + + "${global_platform}${global_arg_delim_1}${global_user}:${global_tag}" + +This plugin's path is: + + $0 + +This plugin's arguments: + + '${*}' + +Showing current version:" + + lib_docker::version type${global_arg_delim_2}short + echo +} + +main "$@" + +# vim: sw=2 sts=2 si ai et