chzyer / readline

Readline is a pure go(golang) implementation for GNU-Readline kind library
MIT License
2.06k stars 273 forks source link

Add support for zOS #226

Open v1gnesh opened 1 year ago

v1gnesh commented 1 year ago

Hi,

Firstly, thank you for this excellent project!

In this PR, I've updated the build tags in a few files to add support for zOS, which is an IBM Z (aka mainframe) operating system.

Test results look like this:

tmpdir: /tmp
=== RUN   TestRetSegment
--- PASS: TestRetSegment (0.00s)
=== RUN   TestSplitSegment
--- PASS: TestSplitSegment (0.00s)
=== RUN   TestSegmentCompleter
--- PASS: TestSegmentCompleter (0.00s)
=== RUN   TestRace
--- PASS: TestRace (0.00s)
=== RUN   TestRuneWidth
--- PASS: TestRuneWidth (0.00s)
=== RUN   TestAggRunes
--- PASS: TestAggRunes (0.00s)
PASS
ok      github.com/chzyer/readline  1.018s
?       github.com/chzyer/readline/example/readline-demo    [no test files]
?       github.com/chzyer/readline/example/readline-im  [no test files]
?       github.com/chzyer/readline/example/readline-multiline   [no test files]
?       github.com/chzyer/readline/example/readline-pass-strength   [no test files]
?       github.com/chzyer/readline/example/readline-remote/readline-remote-client   [no test files]
?       github.com/chzyer/readline/example/readline-remote/readline-remote-server   [no test files]
=== RUN   TestRuneWidth
--- PASS: TestRuneWidth (0.00s)
=== RUN   TestAggRunes
--- PASS: TestAggRunes (0.00s)
PASS
ok      github.com/chzyer/readline/runes    0.410s

... and the output from examples look like this:

$ cd readline-demo && go run .
» enhance
2023/05/28 01:05:08 you said: "enhance"
» mode
current mode: emacs
» login
please enter your password: 
you enter: "boo"
» sleep
2023/05/28 01:06:15 sleep 4 second
» bye

$ cd ../readline-im && go run .
Hi, loopy! My name is Dave.
2023/05/28 01:07:39 Dave: hello
2023/05/28 01:07:41 Dave: hello
.
.
2023/05/28 01:08:44 Dave: bye

$ cd ../readline-multiline && go run .
> why
>>> test
>>> me;
why test me;
> bye;
bye;

$ cd ../readline-pass-strength && go run .
✔ ENT New Password: 
Your password was: toostrong
⚠ ENT New Password: 
Your password was: lame
v1gnesh commented 1 year ago

Hi @chzyer, when you have a chance, could you please review & pull this in?

wader commented 1 year ago

@v1gnesh hey, @chzyer haven't responded in quite a while. if your interesting some ppl have organised a fork with various fixes at https://github.com/ergochat/readline

v1gnesh commented 1 year ago

Thanks for responding here @wader. Terraform depends on chzyer/readline, hence I'm here :) Would you/ergochat be able to request Terraform to switch to your fork?

EDIT: Coincidentally, someone has found a bug in chzyer/readline in the Terraform repo. So I've asked there if they can switch to ergochat/readline. https://github.com/hashicorp/terraform/issues/33195#issuecomment-1571571079

wader commented 1 year ago

@v1gnesh I see, then your kind of in the same boat as us :) i'm not involved in terraform myself but maybe you can ask them about the situation?

wader commented 1 year ago

ping @slingamn for awareness (ergochat maintainer)

slingamn commented 1 year ago

@v1gnesh can you try ergochat/readline v0.0.3? I believe I added zos support already in https://github.com/ergochat/readline/pull/10

v1gnesh commented 1 year ago

@v1gnesh can you try ergochat/readline v0.0.3? I believe I added zos support already in ergochat/readline#10

@slingamn Also curious... what's your story with zos :) ?

slingamn commented 1 year ago

I have no connection to zos :-) I just upgraded readline's internal fork of x/term to v0.6.0, which added zos support in 2021: https://github.com/golang/term/commit/b80969c6736009821b4ff00232b82abb556c2c67