From 71cb986ae00fb54e9fbc5ba8f9d7fdbba4c56bbc Mon Sep 17 00:00:00 2001 From: Nico Grashoff Date: Tue, 6 Apr 2021 00:12:28 +0200 Subject: [PATCH] Add tools example from README --- examples/tools/main.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 examples/tools/main.go diff --git a/examples/tools/main.go b/examples/tools/main.go new file mode 100644 index 0000000..603cc33 --- /dev/null +++ b/examples/tools/main.go @@ -0,0 +1,18 @@ +package main + +import ( + "github.com/ftlops/ftl" + "github.com/ftlops/ftl/ops" +) + +func main() { + ftl.Step("install tools", func() ftl.State { + missing := ops.MissingPackages("gnupg", "tree", "htop") + if len(missing) == 0 { + return ftl.StateUnchanged + } + ops.UpdateRepos() + ops.Install(missing...) + return ftl.StateChanged + }) +}