Skip to content

Commit

Permalink
chore: value updates
Browse files Browse the repository at this point in the history
  • Loading branch information
moshloop committed Aug 30, 2024
1 parent 08b7a4f commit 99bb9fe
Show file tree
Hide file tree
Showing 9 changed files with 161 additions and 94 deletions.
1 change: 1 addition & 0 deletions .vale.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ mdx = md

[*.md]
BasedOnStyles = Vale, Flanksource, alex
Vale.Spelling=no
34 changes: 17 additions & 17 deletions canary-checker/docs/scripting/gotemplate.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ See also [`coll.Keys`](#keys).

Append a value to the end of a list.

_Note that this function does not change the given list; it always produces a new one._
_this function does not change the given list; it always produces a new one._

```go
{{ slice 1 1 2 3 | append 5 }} // [1 1 2 3 5]
Expand All @@ -182,7 +182,7 @@ _Note that this function does not change the given list; it always produces a ne

Prepend a value to the beginning of a list.

_Note that this function does not change the given list; it always produces a new one._
_this function does not change the given list; it always produces a new one._

```go
{{ slice 4 3 2 1 | prepend 5 }} // [5 4 3 2 1]
Expand All @@ -192,7 +192,7 @@ _Note that this function does not change the given list; it always produces a ne

Remove any duplicate values from the list, without changing order.

_Note that this function does not change the given list; it always produces a new one._
_this function does not change the given list; it always produces a new one._

```go
{{ slice 1 2 3 2 3 4 1 5 | uniq }} // [1 2 3 4 5]
Expand All @@ -202,7 +202,7 @@ _Note that this function does not change the given list; it always produces a ne

Flatten a nested list. Defaults to completely flattening all nested lists, but can be limited with `depth`.

_Note that this function does not change the given list; it always produces a new one._
_this function does not change the given list; it always produces a new one._

```go
{{ "[[1,2],[],[[3,4],[[[5],6],7]]]" | jsonArray | flatten }} // [1 2 3 4 5 6 7]
Expand All @@ -213,7 +213,7 @@ _Note that this function does not change the given list; it always produces a ne

Reverse a list.

_Note that this function does not change the given list; it always produces a new one._
_this function does not change the given list; it always produces a new one._

```go
{{ slice 4 3 2 1 | reverse }} // [1 2 3 4]
Expand All @@ -225,7 +225,7 @@ Sort a given list. Uses the natural sort order if possible. For inputs that are

Maps and structs can be sorted by a named key.

_Note that this function does not modify the input._
_this function does not modify the input._

```go
{{ slice "foo" "bar" "baz" | coll.Sort }} // [bar baz foo]
Expand All @@ -240,7 +240,7 @@ _Note that this function does not modify the input._
Merge maps together by overriding src with dst. In other words, the src map can be configured the "default" map, whereas the dst
map can be configured the "overrides". Many source maps can be provided. Precedence is in left-to-right order.

_Note that this function does not modify the input._
_this function does not modify the input._

```go
{{ $default := dict "foo" 1 "bar" 2}}
Expand All @@ -264,7 +264,7 @@ _Note that this function does not modify the input._
Given a map, returns a new map with any entries that have the given keys.

All keys are converted to strings.
_Note that this function does not modify the input._
_this function does not modify the input._

```go
{{ $data := dict "foo" 1 "bar" 2 "baz" 3 }}
Expand All @@ -280,7 +280,7 @@ Given a map, returns a new map without any entries that have the given keys.

All keys are converted to strings.

_Note that this function does not modify the input._
_this function does not modify the input._

```go
{{ $data := dict "foo" 1 "bar" 2 "baz" 3 }}
Expand All @@ -307,7 +307,7 @@ Converts a true-ish string to a boolean. Can be used to simplify conditional sta

Provides a default value given an empty input. Empty inputs are `0` for numeric types, `""` for strings, `false` for booleans, empty arrays/maps, and `nil`.

Note that this will not provide a default for the case where the input is undefined (i.e. referencing things like `.foo` where there is no `foo` field of `.`), but [`conv.Has`](#has) can be used for that.
this will not provide a default for the case where the input is undefined (i.e. referencing things like `.foo` where there is no `foo` field of `.`), but [`conv.Has`](#has) can be used for that.

```go
{{ "" | default "foo" }} // foo
Expand Down Expand Up @@ -852,15 +852,15 @@ A wrapper for Go's [`filepath.VolumeName`](https://golang.org/pkg/path/filepath/

## math

Returns the absolute value of a given number. When the input is an integer, the result will be an `int64`, otherwise it will be a `float64`.
Returns the absolute value of a given number. When the input is an integer, the result is `int64`, otherwise it will be a `float64`.

```go
{{ math.Abs -3.5 }} {{ math.Abs 3.5 }} {{ math.Abs -42 }} // 3.5 3.5 42
```

### Add

Adds all given operators. When one of the inputs is a floating-point number, the result will be a `float64`, otherwise it will be an `int64`.
Adds all given operators. When one of the inputs is a floating-point number, the result will be a `float64`, otherwise it is `int64`.

```go
{{ math.Add 1 2 3 4 }} {{ math.Add 1.5 2 3 }} // 10 6.5
Expand Down Expand Up @@ -1010,7 +1010,7 @@ Returns the nearest integer, rounding half away from zero.
### Seq

Return a sequence from `start` to `end`, in steps of `step`. Can handle counting down as well as up, including with negative numbers.
Note that the sequence _may_ not end at `end`, if `end` is not divisible by `step`.
the sequence _may_ not end at `end`, if `end` is not divisible by `step`.

```go
{{ range (math.Seq 5) }}{{.}} {{end}} // 1 2 3 4 5
Expand All @@ -1019,7 +1019,7 @@ Note that the sequence _may_ not end at `end`, if `end` is not divisible by `ste

### Sub

Subtract the second from the first of the given operators. When one of the inputs is a floating-point number, the result will be a `float64`, otherwise it will be an `int64`.
Subtract the second from the first of the given operators. When one of the inputs is a floating-point number, the result is a `float64`, otherwise it is `int64`.

```go
{{ math.Sub 3 1 }} // 2
Expand Down Expand Up @@ -1164,7 +1164,7 @@ Pick an element at a random from a given slice or array.

Pick a random integer. By default, a number between `0` and `100` (inclusive) is chosen, but this range can be overridden.

Note that the difference between `min` and `max` can not be larger than a 63-bit integer (i.e. the unsigned portion of a 64-bit signed integer). The result is given as an `int64`.
the difference between `min` and `max` can not be larger than a 63-bit integer (i.e. the unsigned portion of a 64-bit signed integer). The result is given as an `int64`.

```go
{{ random.Number }} // 55
Expand Down Expand Up @@ -1734,7 +1734,7 @@ See also [`test.IsKind`](#iskind)

### ternary

Returns one of two values depending on whether the third is true. Note that the third value does not have to be a boolean - it is converted first by the [`conv.ToBool`](#tobool) function (values like `true`, `1`, `"true"`, `"Yes"`, etc... are considered true).
Returns one of two values depending on whether the third is true. the third value does not have to be a boolean - it is converted first by the [`conv.ToBool`](#tobool) function (values like `true`, `1`, `"true"`, `"Yes"`, etc... are considered true).

This is effectively a short-form of the following template:

Expand Down Expand Up @@ -1848,7 +1848,7 @@ It is shorthand for `time.Now.Sub t`.

### Unix

Returns the local `Time` corresponding to the given Unix time, in seconds since January 1, 1970 UTC. Note that fractional seconds can be used to denote milliseconds, but must be specified as a string, not a floating point number.
Returns the local `Time` corresponding to the given Unix time, in seconds since January 1, 1970 UTC. fractional seconds can be used to denote milliseconds, but must be specified as a string, not a floating point number.

_with whole seconds:_

Expand Down
13 changes: 7 additions & 6 deletions canary-checker/docs/windows.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ Installing Canary Checker as a Windows service.

## 1. Check prerequisites

In order to run Canary Checker on windows please ensure the following
To run Canary Checker on windows please ensure the following

1. Your Windows machine has access to the internet, if not you can copy the [Powershell Install Script](https://link-url-here.org) , the [Canary Checker Executable](https://link-url-here.org) and the [NSSM tool](https://nssm.cc/release/nssm-2.24.zip) to a local folder.

2. You must be able to execute the powershell install script as a local administrator
3. Canary Checker uses an embedded Postgress DB which requires [Microsoft Visual C++ 2015-2022 Redistributable (x64) - 14.38.33130](https://www.microsoft.com/en-us/Download/confirmation.aspx?id=52685)
2. You must be able to run the powershell install script as a local administrator
3. Canary Checker uses an embedded Postgres DB which requires [Microsoft Visual C++ 2015-2022 Redistributable (x64) - 14.38.33130](https://www.microsoft.com/en-us/Download/confirmation.aspx?id=52685)

4. Canary checker uses port 8080 (can be changed) for the HTTP API and port 6432 for the embedded postgresql server , ensure these ports are free

## 2. Downloading required files

You only need the powershell script below(assuming internet connectivity). Simply place it in the folder you wish to install Canary Checker in.
You only need the powershell script below(assuming internet connectivity), place it in the folder you wish to install Canary Checker in.

```powershell
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Expand All @@ -29,7 +29,7 @@ Invoke-WebRequest -Uri https://github.com/flanksource/canary-checker/blob/master

### (Optional)

If you require a [specific version of Canary Checker](https://github.com/flanksource/canary-checker/releases) or want to build your own to test, simply place the executable in the same folder as the required powershell script above. Otherwise, the powershell install script will simply download the latest release.
If you require a [specific version of Canary Checker](https://github.com/flanksource/canary-checker/releases) or want to build your own to test, place the executable in the same folder as the required powershell script above. Otherwise, the powershell install script will download the latest release.

## 3. Create a canary

Expand All @@ -56,6 +56,7 @@ To test our canary config without installing it, use the below
```

## 4. Install Canary Checker as a service

The powershell install script is able to download all requirements , if the windows machine does not have internet access you will need to manually download the [prerequisites](/##-1.-check-prerequisites) and place them in the script folder.

```
Expand All @@ -64,4 +65,4 @@ The powershell install script is able to download all requirements , if the wind

Note: Add `-httpPort 8081` to change http port (default is 8080)

Note: You can use the ```-operation uninstall``` to remove the service Or ```-operation reinstall``` to overwrite an exiting install
Note: You can use the `-operation uninstall` to remove the service Or `-operation reinstall` to overwrite an exiting install
14 changes: 9 additions & 5 deletions mission-control/docs/partials/_gotemplate.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ Use a shebang (`#!`) line to choose a different shell (`python`, `bash` and `pws

```yaml
exec:
script: |
//highlight-next-line
#! pwsh
Get-Items | ConvertTo-JSON
script: |
//highlight-next-line
#! pwsh
Get-Items | ConvertTo-JSON
```
</Details>
Expand All @@ -29,23 +29,26 @@ Alternatively [change the templating delimiters](#changing-templating-delimiters
If you are using a YAML multiline string use `|` and not `>` which will strip newlines

Check failure on line 29 in mission-control/docs/partials/_gotemplate.md

View workflow job for this annotation

GitHub Actions / vale

[vale] mission-control/docs/partials/_gotemplate.md#L29

[Flanksource.Spelling] Is 'multiline' spelled correctly? Is it missing code formatting?
Raw output
{"message": "[Flanksource.Spelling] Is 'multiline' spelled correctly? Is it missing code formatting?", "location": {"path": "mission-control/docs/partials/_gotemplate.md", "range": {"start": {"line": 29, "column": 25}}}, "severity": "ERROR"}

Check warning on line 29 in mission-control/docs/partials/_gotemplate.md

View workflow job for this annotation

GitHub Actions / vale

[vale] mission-control/docs/partials/_gotemplate.md#L29

[Flanksource.FutureTense] Use present tense verbs, not future tense verbs like 'will'. Say '(event) happens' instead of '(event) will happen'.
Raw output
{"message": "[Flanksource.FutureTense] Use present tense verbs, not future tense verbs like 'will'. Say '(event) happens' instead of '(event) will happen'.", "location": {"path": "mission-control/docs/partials/_gotemplate.md", "range": {"start": {"line": 29, "column": 68}}}, "severity": "WARNING"}

Instead of:

```yaml
exec:
//highlight-next-line
script: >
#! pwsh
Get-Items | ConvertTo-JSON
```
Do this:
```yaml
exec:
//highlight-next-line
script: |
#! pwsh
Get-Items | ConvertTo-JSON
```
</Details>
</Details>
<Details summary="Changing templating delimiters">
Expand All @@ -61,4 +64,5 @@ exec:
Write-Host "{{ $message }}"
Write-Host @{ Number = 1; Shape = "Square"; Color = "Blue"} | ConvertTo-JSON
```

</Details>
16 changes: 0 additions & 16 deletions styles/Flanksource/Units.yml

This file was deleted.

17 changes: 0 additions & 17 deletions styles/Strict/DictateFeelings.yml

This file was deleted.

13 changes: 0 additions & 13 deletions styles/Strict/FutureTense.yml

This file was deleted.

8 changes: 0 additions & 8 deletions styles/Strict/SpaceAfterPeriod.yml

This file was deleted.

Loading

0 comments on commit 99bb9fe

Please sign in to comment.