Skip to content
This repository has been archived by the owner on Nov 18, 2021. It is now read-only.

tools/trim: fix package doc #387

Closed
wants to merge 1 commit into from

Conversation

twpayne
Copy link
Contributor

@twpayne twpayne commented May 15, 2020

Currently the doc for tools/trim at https://godoc.org/cuelang.org/go shows:

light: ceiling50: { room: "MasterBedroom" brightnessOff: 0.0 // this line brightnessOn: 100.0 // and this line will be removed }

This is due to a couple of blank lines in the tools/trim package comment.

This PR fixes that, and a couple of typos.

Copy link
Contributor

@myitcv myitcv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. FYI - the diff pre post of go doc is as follows:

--- pre 2020-05-16 07:53:38.334860677 +0100
+++ post        2020-05-16 07:53:33.803031316 +0100
@@ -1,11 +1,40 @@
 package trim // import "cuelang.org/go/tools/trim"

+Package trim removes definitions that may be inferred from templates.
+
+A field, struct, or list is removed if it is implied by a constraint, such
+as from an optional field matching a required field, a list type value, a
+comprehension or any other implied content. It will modify the files in
+place.
+
+
+Limitations
+
+Removal is on a best effort basis. Some caveats: - Fields in implied content
+may refer to fields within the struct in which
+
+    they are included, but are only resolved on a best-effort basis.
+
+- Disjunctions that contain structs in implied content cannot be used to
+
+    remove fields.
+
+- There is currently no verification step: manual verification is required.
+
+Examples:
+
+    light: [string]: {
+       room:          string
+       brightnessOff: *0.0 | >=0 & <=100.0
+       brightnessOn:  *100.0 | >=0 & <=100.0
+    }

     light: ceiling50: {
        room:          "MasterBedroom"
        brightnessOff: 0.0    // this line
        brightnessOn:  100.0  // and this line will be removed
     }
+
 Results in:

     light: [string]: {

@myitcv
Copy link
Contributor

myitcv commented May 16, 2020

cc @mpvl

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants