{"id":18053805,"url":"https://github.com/hymkor/go-multiline-ny","last_synced_at":"2026-04-11T12:00:56.634Z","repository":{"id":147444415,"uuid":"618565526","full_name":"hymkor/go-multiline-ny","owner":"hymkor","description":"A REPL-oriented multi-line Readline, without full-screen UI.","archived":false,"fork":false,"pushed_at":"2026-04-09T11:50:07.000Z","size":297,"stargazers_count":10,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-04-09T13:27:23.607Z","etag":null,"topics":["go","golang","readline"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/hymkor/go-multiline-ny","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hymkor.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-03-24T18:46:29.000Z","updated_at":"2026-04-09T11:49:54.000Z","dependencies_parsed_at":"2025-12-14T12:05:20.288Z","dependency_job_id":null,"html_url":"https://github.com/hymkor/go-multiline-ny","commit_stats":null,"previous_names":[],"tags_count":56,"template":false,"template_full_name":null,"purl":"pkg:github/hymkor/go-multiline-ny","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hymkor%2Fgo-multiline-ny","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hymkor%2Fgo-multiline-ny/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hymkor%2Fgo-multiline-ny/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hymkor%2Fgo-multiline-ny/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hymkor","download_url":"https://codeload.github.com/hymkor/go-multiline-ny/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hymkor%2Fgo-multiline-ny/sbom","scorecard":{"id":475111,"data":{"date":"2025-08-11","repo":{"name":"github.com/hymkor/go-multiline-ny","commit":"526500985fdb12d2127f303132027d7d5ae097d1"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.3,"checks":[{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Code-Review","score":0,"reason":"Found 0/29 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":10,"reason":"17 commit(s) and 1 issue activity found in the last 90 days -- score normalized to 10","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 2 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-19T15:05:36.349Z","repository_id":147444415,"created_at":"2025-08-19T15:05:36.349Z","updated_at":"2025-08-19T15:05:36.349Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31679484,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-11T08:18:19.405Z","status":"ssl_error","status_checked_at":"2026-04-11T08:17:08.892Z","response_time":54,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["go","golang","readline"],"created_at":"2024-10-31T00:08:06.418Z","updated_at":"2026-04-11T12:00:56.627Z","avatar_url":"https://github.com/hymkor.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"go-multiline-ny\r\n===============\r\n\r\n[![Go Reference](https://pkg.go.dev/badge/github.com/hymkor/go-multiline-ny.svg)](https://pkg.go.dev/github.com/hymkor/go-multiline-ny)\r\n\r\n**go-multiline-ny** is a **REPL-oriented multi-line editor** built on top of [go-readline-ny], a pure Go Readline-compatible implementation.\r\nIt allows vertical cursor movement across lines, updates only the affected input lines, and does **not** take over the full screen — making it ideal for SQL-like multi-line inputs.\r\nIt is implemented in pure Go, and works on Windows and most UNIX-like systems\r\n(confirmed on Linux and FreeBSD; macOS is expected to work as well).\r\n\r\n\r\n| Key | Feature\r\n|-----|---------\r\n| `Ctrl`+`M` or `Enter` | Insert a new line[^Y]\r\n| `Ctrl`+`J`, `Ctrl`+`Enter` or `Meta`+`Enter` | Submit all lines\r\n| `Ctrl`+`P` or `Up`   | Move cursor to previous line or last line of previous set of input lines in history\r\n| `Ctrl`+`N` or `Down` | Move cursor to next line or first line of next set of input lines in history\r\n| `Meta`+`P` or `Ctrl`+`Up` | Fetch previous set of input lines in history\r\n| `Meta`+`N` or `Ctrl`+`Down` | Fetch next set of input lines in history\r\n| `Ctrl`+`Y` | Paste the string in the clipboard\r\n| `Ctrl`+`R` | Incremental search\r\n\r\n`Meta` means either `Alt`+`key` or `Esc` followed by key.\r\n\r\n[go-readline-ny]: https://github.com/nyaosorg/go-readline-ny\r\n[^Y]: The submit condition can be customized.\r\n\r\n[Example](./examples/example.go)\r\n---------\r\n\r\n![image](./demo.gif)\r\n\r\n```examples/example.go\r\npackage main\r\n\r\nimport (\r\n    \"context\"\r\n    \"fmt\"\r\n    \"io\"\r\n    \"os\"\r\n    \"regexp\"\r\n    \"strings\"\r\n\r\n    \"github.com/mattn/go-colorable\"\r\n\r\n    \"github.com/nyaosorg/go-readline-ny\"\r\n    \"github.com/nyaosorg/go-readline-ny/keys\"\r\n    \"github.com/nyaosorg/go-readline-ny/simplehistory\"\r\n\r\n    \"github.com/hymkor/go-multiline-ny\"\r\n    \"github.com/hymkor/go-multiline-ny/completion\"\r\n)\r\n\r\nvar (\r\n    commands = []string{\"select\", \"insert\", \"delete\", \"update\"}\r\n    tables   = []string{\"dept\", \"emp\", \"bonus\", \"salgrade\"}\r\n    columns  = []string{\"deptno\", \"dname\", \"loc\", \"empno\", \"ename\", \"job\", \"mgr\", \"hiredate\", \"sal\", \"comm\", \"grade\", \"losal\", \"hisal\"}\r\n)\r\n\r\nfunc getCompletionCandidates(fields []string) (forCompletion []string, forListing []string) {\r\n    candidates := commands\r\n    for _, word := range fields {\r\n        if strings.EqualFold(word, \"from\") {\r\n            candidates = append([]string{\"where\"}, tables...)\r\n        } else if strings.EqualFold(word, \"set\") {\r\n            candidates = append([]string{\"where\"}, columns...)\r\n        } else if strings.EqualFold(word, \"update\") {\r\n            candidates = append([]string{\"set\"}, tables...)\r\n        } else if strings.EqualFold(word, \"delete\") {\r\n            candidates = []string{\"from\"}\r\n        } else if strings.EqualFold(word, \"select\") {\r\n            candidates = append([]string{\"from\"}, columns...)\r\n        } else if strings.EqualFold(word, \"where\") {\r\n            candidates = append([]string{\"and\", \"or\"}, columns...)\r\n        }\r\n    }\r\n    return candidates, candidates\r\n}\r\n\r\nfunc main() {\r\n    ctx := context.Background()\r\n    fmt.Println(\"C-m or Enter      : Insert a linefeed\")\r\n    fmt.Println(\"C-p or UP         : Move to the previous line.\")\r\n    fmt.Println(\"C-n or DOWN       : Move to the next line\")\r\n    fmt.Println(\"C-j or Meta+Enter : Submit\")\r\n    fmt.Println(\"C-c               : Abort.\")\r\n    fmt.Println(\"C-D with no chars : Quit.\")\r\n    fmt.Println(\"C-UP   or Meta-P  : Move to the previous history entry\")\r\n    fmt.Println(\"C-DOWN or Meta-N  : Move to the next history entry\")\r\n\r\n    var ed multiline.Editor\r\n    ed.SetPrompt(func(w io.Writer, lnum int) (int, error) {\r\n        return fmt.Fprintf(w, \"[%d] \", lnum+1)\r\n    })\r\n    ed.SetPredictColor(readline.PredictColorBlueItalic)\r\n\r\n    ed.Highlight = []readline.Highlight{\r\n        // Words -\u003e dark green\r\n        {Pattern: regexp.MustCompile(`(?i)(SELECT|INSERT|FROM|WHERE|AS)`), Sequence: \"\\x1B[33;49;22m\"},\r\n        // Double quotation -\u003e light magenta\r\n        {Pattern: regexp.MustCompile(`(?m)\"([^\"\\n]*\\\\\")*[^\"\\n]*$|\"([^\"\\n]*\\\\\")*[^\"\\n]*\"`), Sequence: \"\\x1B[32;49;1m\"},\r\n        // Single quotation -\u003e light red\r\n        {Pattern: regexp.MustCompile(`(?m)'([^'\\n]*\\\\')*[^'\\n]*$|'([^'\\n]*\\\\')*[^'\\n]*'`), Sequence: \"\\x1B[31;49;1m\"},\r\n        // Number literal -\u003e light blue\r\n        {Pattern: regexp.MustCompile(`[0-9]+`), Sequence: \"\\x1B[34;49;1m\"},\r\n        // Comment -\u003e dark gray\r\n        {Pattern: regexp.MustCompile(`(?s)/\\*.*?\\*/`), Sequence: \"\\x1B[30;49;1m\"},\r\n        // Multiline string literal -\u003e dark red\r\n        {Pattern: regexp.MustCompile(\"(?s)```.*?```\"), Sequence: \"\\x1B[31;49;22m\"},\r\n    }\r\n    ed.ResetColor = \"\\x1B[0m\"\r\n    ed.DefaultColor = \"\\x1B[37;49;1m\"\r\n\r\n    // To enable escape sequence on Windows.\r\n    // (On other operating systems, it can be omitted)\r\n    ed.SetWriter(colorable.NewColorableStdout())\r\n\r\n    // enable history (optional)\r\n    history := simplehistory.New()\r\n    ed.SetHistory(history)\r\n    ed.SetHistoryCycling(true)\r\n\r\n    // enable completion (optional)\r\n    ed.BindKey(keys.CtrlI, \u0026completion.CmdCompletionOrList{\r\n        // Characters listed here are excluded from completion.\r\n        Delimiter: \"\u0026|\u003e\u003c;\",\r\n        // Enclose candidates with these characters when they contain spaces\r\n        Enclosure: `\"'`,\r\n        // String to append when only one candidate remains\r\n        Postfix: \" \",\r\n        // Function for listing candidates\r\n        Candidates: getCompletionCandidates,\r\n    })\r\n\r\n    // Show newline mark (experimental)\r\n    ed.OnAfterRender = func(w io.Writer, availWidth int) {\r\n        if availWidth \u003e= 2 {\r\n            io.WriteString(w, \"\\x1B[33;22m↓\\x1B[39m\")\r\n        }\r\n    }\r\n\r\n    for {\r\n        lines, err := ed.Read(ctx)\r\n        if err != nil {\r\n            fmt.Fprintln(os.Stderr, err.Error())\r\n            return\r\n        }\r\n        L := strings.Join(lines, \"\\n\")\r\n        fmt.Println(\"-----\")\r\n        fmt.Println(L)\r\n        fmt.Println(\"-----\")\r\n        history.Add(L)\r\n    }\r\n}\r\n```\r\n\r\n[Terminate input only if you type Enter when it ends with a semicolon](./examples/example-semi.go)\r\n---------\r\n\r\n```examples/example-semi.go\r\npackage main\r\n\r\nimport (\r\n    \"context\"\r\n    \"fmt\"\r\n    \"io\"\r\n    \"os\"\r\n    \"strings\"\r\n\r\n    \"github.com/atotto/clipboard\"\r\n    \"github.com/mattn/go-colorable\"\r\n\r\n    \"github.com/nyaosorg/go-readline-ny/simplehistory\"\r\n\r\n    \"github.com/hymkor/go-multiline-ny\"\r\n)\r\n\r\ntype OSClipboard struct{}\r\n\r\nfunc (OSClipboard) Read() (string, error) {\r\n    return clipboard.ReadAll()\r\n}\r\n\r\nfunc (OSClipboard) Write(s string) error {\r\n    return clipboard.WriteAll(s)\r\n}\r\n\r\nfunc main() {\r\n    ctx := context.Background()\r\n    fmt.Println(\"C-m or Enter      : Submit when lines end with `;`\")\r\n    fmt.Println(\"                    Otherwise insert a linefeed.\")\r\n    fmt.Println(\"C-j               : Submit always\")\r\n    fmt.Println(\"C-c               : Abort.\")\r\n    fmt.Println(\"C-D with no chars : Quit.\")\r\n\r\n    var ed multiline.Editor\r\n    ed.SetPrompt(func(w io.Writer, lnum int) (int, error) {\r\n        return fmt.Fprintf(w, \"[%d] \", lnum+1)\r\n    })\r\n\r\n    ed.SubmitOnEnterWhen(func(lines []string, _ int) bool {\r\n        return strings.HasSuffix(strings.TrimSpace(lines[len(lines)-1]), \";\")\r\n    })\r\n\r\n    // To enable escape sequence on Windows.\r\n    // (On other operating systems, it can be omitted)\r\n    ed.SetWriter(colorable.NewColorableStdout())\r\n\r\n    // Use the clipboard of the operating system.\r\n    ed.LineEditor.Clipboard = OSClipboard{}\r\n\r\n    history := simplehistory.New()\r\n    ed.SetHistory(history)\r\n    ed.SetHistoryCycling(true)\r\n\r\n    for {\r\n        lines, err := ed.Read(ctx)\r\n        if err != nil {\r\n            fmt.Fprintln(os.Stderr, err.Error())\r\n            return\r\n        }\r\n        L := strings.Join(lines, \"\\n\")\r\n        fmt.Println(\"-----\")\r\n        fmt.Println(L)\r\n        fmt.Println(\"-----\")\r\n        history.Add(L)\r\n    }\r\n}\r\n```\r\n\r\n\r\nChangelog\r\n---------\r\n\r\n- [Changelog (English)](./CHANGELOG.md)\r\n- [Changelog (Japanese)](./CHANGELOG_ja.md)\r\n\r\nAcknowledgements\r\n----------------\r\n\r\n- [spiegel-im-spiegel (Spiegel)](https://github.com/spiegel-im-spiegel)\r\n- [apstndb](https://github.com/apstndb)\r\n\r\nAuthor\r\n------\r\n\r\n- [hymkor (HAYAMA Kaoru)](https://github.com/hymkor)\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhymkor%2Fgo-multiline-ny","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhymkor%2Fgo-multiline-ny","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhymkor%2Fgo-multiline-ny/lists"}