diff options
author | Karel Kočí <cynerd@email.cz> | 2017-09-20 21:19:05 +0200 |
---|---|---|
committer | Karel Kočí <cynerd@email.cz> | 2017-09-20 21:22:36 +0200 |
commit | f287ecedc78c0cc8fb485c5995b8d1cfae9f0fe8 (patch) | |
tree | 5025b33a8c3d4c69ad2b62e1169b669c56f712f9 /utils/ops | |
parent | 65f52ead41dc6df73671ddd3a8c6a2edecb6dfb3 (diff) | |
download | multiconfig-complicated.tar.gz multiconfig-complicated.tar.bz2 multiconfig-complicated.zip |
Commit current statecomplicated
Diffstat (limited to 'utils/ops')
-rw-r--r-- | utils/ops | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/utils/ops b/utils/ops new file mode 100644 index 0000000..1365ec8 --- /dev/null +++ b/utils/ops @@ -0,0 +1,30 @@ +# vim:ft=sh:noexpandtab +# Utility functions for operations + +# Set operation we are working on +ops_set_current() { + OPERATION_CURRENT="$1" +} + +ops_require() { + while [ $# -gt 0 ]; do + dict_set "ops/$OPERATION_CURRENT" "$1" true + shift + done +} + +ops_required_any() { + if ! dict_empty "ops/$OPERATION_CURRENT"; then + echo_warn "$1 requires update for following components: $(ops_required_list)" + else + return 1 + fi +} + +ops_is_required() { + dict_contains "ops/$OPERATION_CURRENT" "$1" +} + +ops_required_list() { + dict_keys "ops/$OPERATION_CURRENT" +} |