Skip to content

Commit

Permalink
Merge pull request #785 from lmorg/develop
Browse files Browse the repository at this point in the history
v6.0
  • Loading branch information
lmorg committed Feb 17, 2024
2 parents ce7969f + fc8f70c commit e081c89
Show file tree
Hide file tree
Showing 31 changed files with 593 additions and 156 deletions.
6 changes: 3 additions & 3 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ const Name = "murex"
// Format of version string should be "(major).(minor).(revision) DESCRIPTION"
const (
version = "%d.%d.%d"
Major = 5
Minor = 3
Revision = 7000
Major = 6
Minor = 0
Revision = 1000
)

// Copyright is the copyright owner string
Expand Down
17 changes: 0 additions & 17 deletions behavioural/murex_flags.mx
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,6 @@ test: unit function murex.flag.try.pipe {
"StdoutRegex": "bar"
}

function murex.flag.try.errpipe {
exec: $MUREX_EXE --try -c (err: "foo" ? out "bar")
}

test: unit function murex.flag.try.errpipe {
"StdoutRegex": "bar"
}

function murex.flag.trypipe.semicolon {
exec: $MUREX_EXE --trypipe -c (err: "foo"; out "bar")
}
Expand All @@ -43,12 +35,3 @@ test: unit function murex.flag.trypipe.pipe {
"StderrRegex": "foo",
"ExitNum": 1
}

function murex.flag.trypipe.errpipe {
exec: $MUREX_EXE --trypipe -c (err: "foo" ? out "bar")
}

test: unit function murex.flag.trypipe.errpipe {
"StderrRegex": "Error",
"ExitNum": 1
}
20 changes: 20 additions & 0 deletions builtins/core/structs/if_doc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@
```
Flags:
Detail: |-
### Pipelines and Output
The conditional block can contain entire pipelines - even multiple lines of code
let alone a single pipeline - as well as solitary commands as demonstrated in
the examples above. However the conditional block does not output STDOUT nor
Expand All @@ -96,6 +98,24 @@
use either a Murex named pipe to redirect the output, or test or debug flags
(depending on your use case) if you only need to occasionally inspect the
conditionals output.
### Exit Numbers
When evaluating a command or code block, `if` will treat an exit number less
than 0 as true, and one greater than 0 as false. When the exit number is 0, `if`
will examine the stdout of the command or code block. If there is no output, or
the output is one of the following strings, `if` will evaluate the command or
code block as false. Otherwise, it will be considered true.
* `0`
* `disabled`
* `fail`
* `failed`
* `false`
* `no`
* `null`
* `off`
Synonyms:
- if
- "!if"
Expand Down
2 changes: 1 addition & 1 deletion builtins/core/typemgmt/let.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func init() {
}

func cmdLet(p *lang.Process) (err error) {
//p.Stdout.SetDataType(types.Null)
lang.Deprecated(p)

if !debug.Enabled {
defer func() {
Expand Down
2 changes: 2 additions & 0 deletions builtins/core/typemgmt/math.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ func init() {
}

func cmdEqu(p *lang.Process) (err error) {
lang.Deprecated(p)

if p.Parameters.Len() == 0 {
return errors.New("missing expression")
}
Expand Down
2 changes: 2 additions & 0 deletions builtins/docs/summaries.go
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,7 @@ func init() {
"changelog/v5.1": "This release brings new operators and a builtin, all for managing null types. There is also a substantial revamp to readline's responsiveness.",
"changelog/v5.2": "The v5.2 release introduces significant new features and improvements for those using Murex as their interactive shell. Many of these features are unique to Murex.",
"changelog/v5.3": "Caching has been vastly improved in this release due to a new sqlite3-backed persistent `cache.db`. There have also been some improvements to `[f1]` help pages",
"changelog/v6.0": "Despite this being a new major version release, it is a vary minor update. Aside from a handful of bugfixes, the most significant change is notice of deprecation for `=`, `let`, and `?`.",
}

Synonym = map[string]string{
Expand Down Expand Up @@ -952,5 +953,6 @@ func init() {
"changelog/v5.1": "changelog/v5.1",
"changelog/v5.2": "changelog/v5.2",
"changelog/v5.3": "changelog/v5.3",
"changelog/v6.0": "changelog/v6.0",
}
}
26 changes: 18 additions & 8 deletions builtins/types/csv/marshal.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
enc "encoding/csv"
"fmt"
"io"
"os"
"reflect"

"github.com/lmorg/murex/lang"
Expand All @@ -16,6 +17,8 @@ func marshal(p *lang.Process, iface interface{}) ([]byte, error) {
buf := bytes.NewBuffer(b)
w := enc.NewWriter(buf)

//if term.

separator, err := p.Config.Get("csv", "separator", types.String)
if err != nil {
return nil, err
Expand All @@ -32,8 +35,7 @@ func marshal(p *lang.Process, iface interface{}) ([]byte, error) {
return buf.Bytes(), err
}
}
w.Flush()
return buf.Bytes(), w.Error()
break

case [][]string:
for i := range v {
Expand All @@ -42,8 +44,7 @@ func marshal(p *lang.Process, iface interface{}) ([]byte, error) {
return buf.Bytes(), err
}
}
w.Flush()
return buf.Bytes(), w.Error()
break

case []interface{}:
if len(v) == 0 {
Expand All @@ -58,21 +59,30 @@ func marshal(p *lang.Process, iface interface{}) ([]byte, error) {
return buf.Bytes(), err
}
}
w.Flush()
return buf.Bytes(), w.Error()
break
}

err = types.MapToTable(v, func(s []string) error { return w.Write(s) })
if err != nil {
return nil, err
}
w.Flush()
return buf.Bytes(), w.Error()

default:
err = fmt.Errorf("cannot marshal %T data into a `%s`", v, typeName)
return buf.Bytes(), err
}

var table []byte
if os.Getenv("MXTTY") == "true" {
table = []byte("\x1b_begin;table;{\"Format\":\"csv\"}\x1b\\")
}
table = append(table, buf.Bytes()...)
if os.Getenv("MXTTY") == "true" {
table = append(table, []byte("\x1b_end;table\x1b\\")...)
}

w.Flush()
return table, w.Error()
}

func unmarshal(p *lang.Process) (interface{}, error) {
Expand Down
14 changes: 12 additions & 2 deletions config/defaults/profile_any.mx
Original file line number Diff line number Diff line change
Expand Up @@ -674,10 +674,10 @@ autocomplete set docgen %[
]

config define open image %{
Description: Which mode to render images to the terminal
Description: "Which mode to render images to the terminal"
DataType: str
Default: auto
Options: [ auto compatible kitty iterm terminology sixel ]
Options: [ auto compatible mxtty kitty iterm terminology sixel ]
}

openagent set image {
Expand All @@ -687,6 +687,7 @@ openagent set image {
if { = mode==`auto` } {
switch {
case { $TMUX } { set mode=compatible }
case { $MXTTY } { set mode=mxtty }
case { $ITERM_PROFILE } { set mode=iterm }
case { $TERM_PROGRAM == "iTerm.app" } { set mode=iterm }
case { $KITTY_WINDOW_ID } { set mode=kitty }
Expand All @@ -707,6 +708,15 @@ openagent set image {
open-image $file
}

case mxtty {
if { $SSH_TTY } {
$json = %{ Base64: ${base64 -i $file -o -} }
} else {
$json = %{ Filename: $file }
}
out "{ESC}_insert;image;$(json){ESC}\\"
}

case kitty {
try {
kitty icat $file
Expand Down
5 changes: 5 additions & 0 deletions docs/changelog/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ Track new features, any breaking changes, and the release history here.

## Articles

### 17.02.2024 - [v6.0](../changelog/v6.0.md)

Despite this being a new major version release, it is a vary minor update. Aside from a handful of bugfixes, the most significant change is notice of deprecation for `=`, `let`, and `?`.


### 02.01.2024 - [v5.3](../changelog/v5.3.md)

Caching has been vastly improved in this release due to a new sqlite3-backed persistent `cache.db`. There have also been some improvements to `[f1]` help pages
Expand Down
62 changes: 62 additions & 0 deletions docs/changelog/v6.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# v6.0

Despite this being a new major version release, it is a vary minor update. Aside from a handful of bugfixes, the most significant change is notice of deprecation for `=`, `let`, and `?`.

## Breaking Changes

None

## Deprecation Warnings

Please read out [compatibility commitment](https://murex.rocks/compatibility.html) to understand how features are deprecated.

* the `?` pipe will be deprecated to make way for a the ternary operator. You can achieve the same result with `<err> <!out>`, eg `command <err> <!out> parameters... | next-command ...`

* the `=` and `let` builtins are now officially deprecated. They've been marked as deprecated in the documentation for a couple of years but you'll now receive a deprecation warning when using them. This warning will not impact any functions that call them (they bypass the STDOUT and STDERR pipes and write directly to your TTY) but it is still recommended that you update any existing code not to use it. The change is very simple, Murex supported expressions as first class primitives, so you can simply drop the `=` and `let` command names from your expressions

## Features

Features marked as **EXPERIMENTAL** are provided without assurances of future breaking changes. All other features are considered stable as part of Murex's [compatibility commitment](https://murex.rocks/compatibility.html).

* new integrations for the experimental `mxtty` terminal emulator ([Github repo](https://github.com/lmorg/mxtty))

## Bug Fixes

* `which` and `whereis` autocompletions were Linux specific. Now they're enabled for all platforms

* `grep` and `egrep` aliases were Linux specific. Now they're enabled for all POSIX platforms

* zero length environment variables are no longer being reported as `null` by `is-null` ([issue #786](https://github.com/lmorg/murex/issues/786))

* fixed edge case where a zero length string could generate a panic when normalising paths ([issue #789](https://github.com/lmorg/murex/issues/789))

* suppress sqlite3 cache error message. The error doesn't impact the operation of Murex, it just spooks users ([issue #788](https://github.com/lmorg/murex/issues/788))

## Special Thanks

Special thank yous for this release goes to everyone in the discussions group for raising bug reports and their design discussions.

You rock!

<hr>

Published: 17.02.2024 at 20:47

## See Also

* [Contributing](../Murex/CONTRIBUTING.md):
Guide to contributing to Murex
* [`autocomplete`](../commands/autocomplete.md):
Set definitions for tab-completion in the command line
* [`config`](../commands/config.md):
Query or define Murex runtime settings
* [`export`](../commands/export.md):
Define an environmental variable and set it's value
* [`is-null`](../commands/is-null.md):
Checks if a variable is null or undefined
* [`runtime`](../commands/runtime.md):
Returns runtime information on the internal state of Murex

<hr/>

This document was generated from [gen/changelog/v6.0_doc.yaml](https://github.com/lmorg/murex/blob/master/gen/changelog/v6.0_doc.yaml).
19 changes: 19 additions & 0 deletions docs/commands/if.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ if { g somefile.txt } else {

## Detail

### Pipelines and Output

The conditional block can contain entire pipelines - even multiple lines of code
let alone a single pipeline - as well as solitary commands as demonstrated in
the examples above. However the conditional block does not output STDOUT nor
Expand All @@ -100,6 +102,23 @@ use either a Murex named pipe to redirect the output, or test or debug flags
(depending on your use case) if you only need to occasionally inspect the
conditionals output.

### Exit Numbers

When evaluating a command or code block, `if` will treat an exit number less
than 0 as true, and one greater than 0 as false. When the exit number is 0, `if`
will examine the stdout of the command or code block. If there is no output, or
the output is one of the following strings, `if` will evaluate the command or
code block as false. Otherwise, it will be considered true.

* `0`
* `disabled`
* `fail`
* `failed`
* `false`
* `no`
* `null`
* `off`

## Synonyms

* `if`
Expand Down
3 changes: 3 additions & 0 deletions docs/user-guide/ansi.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ var constants = map[string][]byte{
"ALT-7": {27, 55},
"ALT-8": {27, 56},
"ALT-9": {27, 57},

// control seqs
"CSI": {27, 91},
}

var sgr = map[string][]byte{
Expand Down
35 changes: 35 additions & 0 deletions gen/changelog/v6.0.inc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
## Breaking Changes

None

## Deprecation Warnings

Please read out [compatibility commitment](https://murex.rocks/compatibility.html) to understand how features are deprecated.

* the `?` pipe will be deprecated to make way for a the ternary operator. You can achieve the same result with `<err> <!out>`, eg `command <err> <!out> parameters... | next-command ...`

* the `=` and `let` builtins are now officially deprecated. They've been marked as deprecated in the documentation for a couple of years but you'll now receive a deprecation warning when using them. This warning will not impact any functions that call them (they bypass the STDOUT and STDERR pipes and write directly to your TTY) but it is still recommended that you update any existing code not to use it. The change is very simple, Murex supported expressions as first class primitives, so you can simply drop the `=` and `let` command names from your expressions

## Features

Features marked as **EXPERIMENTAL** are provided without assurances of future breaking changes. All other features are considered stable as part of Murex's [compatibility commitment](https://murex.rocks/compatibility.html).

* new integrations for the experimental `mxtty` terminal emulator ([Github repo](https://github.com/lmorg/mxtty))

## Bug Fixes

* `which` and `whereis` autocompletions were Linux specific. Now they're enabled for all platforms

* `grep` and `egrep` aliases were Linux specific. Now they're enabled for all POSIX platforms

* zero length environment variables are no longer being reported as `null` by `is-null` ([issue #786](https://github.com/lmorg/murex/issues/786))

* fixed edge case where a zero length string could generate a panic when normalising paths ([issue #789](https://github.com/lmorg/murex/issues/789))

* suppress sqlite3 cache error message. The error doesn't impact the operation of Murex, it just spooks users ([issue #788](https://github.com/lmorg/murex/issues/788))

## Special Thanks

Special thank yous for this release goes to everyone in the discussions group for raising bug reports and their design discussions.

You rock!
18 changes: 18 additions & 0 deletions gen/changelog/v6.0_doc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
- DocumentID: v6.0
Title: >-
v6.0
CategoryID: changelog
DateTime: 2024-02-17 20:47
Summary: >-
Despite this being a new major version release, it is a vary minor update.
Aside from a handful of bugfixes, the most significant change is notice of
deprecation for `=`, `let`, and `?`.
Description: |-
{{ include "gen/changelog/v6.0.inc.md" }}
Related:
- CONTRIBUTING
- autocomplete
- export
- config
- runtime
- is-null
Loading

0 comments on commit e081c89

Please sign in to comment.