cue/format: expose some options in the API
UseSpaces
TabIndent
Change-Id: I44d88b47a5d5ad6d3ec0964cd1e83b7196d69bda
diff --git a/cue/format/format.go b/cue/format/format.go
index 7127328..23644fc 100644
--- a/cue/format/format.go
+++ b/cue/format/format.go
@@ -42,6 +42,21 @@
return func(c *config) { c.simplify = true }
}
+// UseSpaces specifies that tabs should be converted to spaces and sets the
+// default tab width.
+func UseSpaces(tabwidth int) Option {
+ return func(c *config) {
+ c.UseSpaces = true
+ c.Tabwidth = tabwidth
+ }
+}
+
+// TabIndent specifies whether to use tabs for indentation independent of
+// UseSpaces.
+func TabIndent(indent bool) Option {
+ return func(c *config) { c.TabIndent = indent }
+}
+
// TODO: other options:
//
// const (