summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@baturin.org>2016-12-28 11:47:06 +0700
committerDaniil Baturin <daniil@baturin.org>2016-12-28 11:47:06 +0700
commitc5ccc0d38bab3b783a28d5f4f2b458e370429dad (patch)
tree6ac3185262438d362602bb208c6b6e4682d3e2db /src
parent26a2e2862efd662b12a56e94785a163417b981c2 (diff)
downloadvyconf-c5ccc0d38bab3b783a28d5f4f2b458e370429dad.tar.gz
vyconf-c5ccc0d38bab3b783a28d5f4f2b458e370429dad.zip
Add a function to convert config operations to commands.
Diffstat (limited to 'src')
-rw-r--r--src/session.ml14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/session.ml b/src/session.ml
index b5492ea..ee51c55 100644
--- a/src/session.ml
+++ b/src/session.ml
@@ -27,6 +27,20 @@ let make world = {
changeset = []
}
+let string_of_op op =
+ match op with
+ | CfgSet (path, value, _) ->
+ let path_str = Util.string_of_path path in
+ (match value with
+ | None -> Printf.sprintf "set %s" path_str
+ | Some v -> Printf.sprintf "set %s %s" path_str v)
+ | CfgDelete (path, value) ->
+ let path_str = Util.string_of_path path in
+ (match value with
+ | None -> Printf.sprintf "delete %s" path_str
+ | Some v -> Printf.sprintf "delete %s %s" path_str v)
+
+
let set_modified s =
if s.modified = true then s
else {s with modified = true}