{"id":37180055,"url":"https://github.com/ddvk/ishell","last_synced_at":"2026-01-14T20:56:26.576Z","repository":{"id":57570940,"uuid":"347013547","full_name":"ddvk/ishell","owner":"ddvk","description":"Library for creating interactive cli applications.","archived":false,"fork":true,"pushed_at":"2021-03-12T09:43:35.000Z","size":146,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-31T22:39:52.529Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"abiosoft/ishell","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ddvk.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-03-12T09:38:08.000Z","updated_at":"2021-03-12T09:43:38.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/ddvk/ishell","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/ddvk/ishell","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ddvk%2Fishell","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ddvk%2Fishell/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ddvk%2Fishell/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ddvk%2Fishell/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ddvk","download_url":"https://codeload.github.com/ddvk/ishell/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ddvk%2Fishell/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28434500,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T18:57:19.464Z","status":"ssl_error","status_checked_at":"2026-01-14T18:52:48.501Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":[],"created_at":"2026-01-14T20:56:25.836Z","updated_at":"2026-01-14T20:56:26.569Z","avatar_url":"https://github.com/ddvk.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ishell\nishell is an interactive shell library for creating interactive cli applications.\n\n[![Documentation](https://img.shields.io/badge/godoc-reference-blue.svg?style=flat-square)](https://godoc.org/github.com/abiosoft/ishell)\n[![Go Report Card](https://goreportcard.com/badge/github.com/abiosoft/ishell)](https://goreportcard.com/report/github.com/abiosoft/ishell)\n\n## Older version\nThe current master is not backward compatible with older version. Kindly change your import path to `gopkg.in/abiosoft/ishell.v1`.\n\nOlder version of this library is still available at [https://gopkg.in/abiosoft/ishell.v1](https://gopkg.in/abiosoft/ishell.v1).\n\nHowever, you are advised to upgrade to v2 [https://gopkg.in/abiosoft/ishell.v2](https://gopkg.in/abiosoft/ishell.v2).\n\n## Usage\n\n```go\nimport \"strings\"\nimport \"github.com/abiosoft/ishell\"\n\nfunc main(){\n    // create new shell.\n    // by default, new shell includes 'exit', 'help' and 'clear' commands.\n    shell := ishell.New()\n\n    // display welcome info.\n    shell.Println(\"Sample Interactive Shell\")\n\n    // register a function for \"greet\" command.\n    shell.AddCmd(\u0026ishell.Cmd{\n        Name: \"greet\",\n        Help: \"greet user\",\n        Func: func(c *ishell.Context) {\n            c.Println(\"Hello\", strings.Join(c.Args, \" \"))\n        },\n    })\n\n    // run shell\n    shell.Run()\n}\n```\nExecution\n```\nSample Interactive Shell\n\u003e\u003e\u003e help\n\nCommands:\n  clear      clear the screen\n  greet      greet user\n  exit       exit the program\n  help       display help\n\n\u003e\u003e\u003e greet Someone Somewhere\nHello Someone Somewhere\n\u003e\u003e\u003e exit\n$\n```\n\n### Reading input\n```go\n// simulate an authentication\nshell.AddCmd(\u0026ishell.Cmd{\n    Name: \"login\",\n    Help: \"simulate a login\",\n    Func: func(c *ishell.Context) {\n        // disable the '\u003e\u003e\u003e' for cleaner same line input.\n        c.ShowPrompt(false)\n        defer c.ShowPrompt(true) // yes, revert after login.\n\n        // get username\n        c.Print(\"Username: \")\n        username := c.ReadLine()\n\n        // get password.\n        c.Print(\"Password: \")\n        password := c.ReadPassword()\n\n        ... // do something with username and password\n\n        c.Println(\"Authentication Successful.\")\n    },\n})\n```\nExecution\n```\n\u003e\u003e\u003e login\nUsername: someusername\nPassword:\nAuthentication Successful.\n```\n\n### Multiline input\nBuiltin support for multiple lines.\n```\n\u003e\u003e\u003e This is \\\n... multi line\n\n\u003e\u003e\u003e Cool that \u003c\u003c EOF\n... everything here goes\n... as a single argument.\n... EOF\n```\nUser defined\n```go\nshell.AddCmd(\u0026ishell.Cmd{\n    Name: \"multi\",\n    Help: \"input in multiple lines\",\n    Func: func(c *ishell.Context) {\n        c.Println(\"Input multiple lines and end with semicolon ';'.\")\n        lines := c.ReadMultiLines(\";\")\n        c.Println(\"Done reading. You wrote:\")\n        c.Println(lines)\n    },\n})\n```\nExecution\n```\n\u003e\u003e\u003e multi\nInput multiple lines and end with semicolon ';'.\n\u003e\u003e\u003e this is user defined\n... multiline input;\nYou wrote:\nthis is user defined\nmultiline input;\n```\n### Keyboard interrupt\nBuiltin interrupt handler.\n```\n\u003e\u003e\u003e ^C\nInput Ctrl-C once more to exit\n\u003e\u003e\u003e ^C\nInterrupted\nexit status 1\n```\nCustom\n```go\nshell.Interrupt(func(count int, c *ishell.Context) { ... })\n```\n\n### Multiple Choice\n\n```go\nfunc(c *ishell.Context) {\n    choice := c.MultiChoice([]string{\n        \"Golangers\",\n        \"Go programmers\",\n        \"Gophers\",\n        \"Goers\",\n    }, \"What are Go programmers called ?\")\n    if choice == 2 {\n        c.Println(\"You got it!\")\n    } else {\n        c.Println(\"Sorry, you're wrong.\")\n    }\n},\n```\nOutput\n```\nWhat are Go programmers called ?\n  Golangers\n  Go programmers\n\u003e Gophers\n  Goers\n\nYou got it!\n```\n### Checklist\n```go\nfunc(c *ishell.Context) {\n    languages := []string{\"Python\", \"Go\", \"Haskell\", \"Rust\"}\n    choices := c.Checklist(languages,\n        \"What are your favourite programming languages ?\", nil)\n    out := func() []string { ... } // convert index to language\n    c.Println(\"Your choices are\", strings.Join(out(), \", \"))\n}\n```\nOutput\n```\nWhat are your favourite programming languages ?\n    Python\n  ✓ Go\n    Haskell\n \u003e✓ Rust\n\nYour choices are Go, Rust\n```\n\n### Progress Bar\nDeterminate\n```go\nfunc(c *ishell.Context) {\n    c.ProgressBar().Start()\n    for i := 0; i \u003c 101; i++ {\n        c.ProgressBar().Suffix(fmt.Sprint(\" \", i, \"%\"))\n        c.ProgressBar().Progress(i)\n        ... // some background computation\n    }\n    c.ProgressBar().Stop()\n}\n```\nOutput\n```\n[==========\u003e         ] 50%\n```\n\nIndeterminate\n```go\n\nfunc(c *ishell.Context) {\n    c.ProgressBar().Indeterminate(true)\n    c.ProgressBar().Start()\n    ... // some background computation\n    c.ProgressBar().Stop()\n}\n```\nOutput\n```\n[ ====               ]\n```\n\nCustom display using [briandowns/spinner](https://github.com/briandowns/spinner).\n```go\ndisplay := ishell.ProgressDisplayCharSet(spinner.CharSets[11])\nfunc(c *Context) { c.ProgressBar().Display(display) ... }\n\n// or set it globally\nishell.ProgressBar().Display(display)\n```\n\n### Durable history\n```go\n// Read and write history to $HOME/.ishell_history\nshell.SetHomeHistoryPath(\".ishell_history\")\n```\n\n\n### Non-interactive execution\nIn some situations it is desired to exit the program directly after executing a single command.\n\n```go\n// when started with \"exit\" as first argument, assume non-interactive execution\nif len(os.Args) \u003e 1 \u0026\u0026 os.Args[1] == \"exit\" {\n    shell.Process(os.Args[2:]...)\n} else {\n    // start shell\n    shell.Run()\n}\n```\n\n```bash\n# Run normally - interactive mode:\n$ go run main.go\n\u003e\u003e\u003e |\n\n# Run non-interactivelly\n$ go run main.go exit greet Someusername\nHello Someusername\n```\n\n\n### Output with Color\nYou can use [fatih/color](https://github.com/fatih/color).\n\n```go\nfunc(c *ishell.Context) {\n    yellow := color.New(color.FgYellow).SprintFunc()\n    c.Println(yellow(\"This line is yellow\"))\n}\n```\nExecution\n```sh\n\u003e\u003e\u003e color\nThis line is yellow\n```\n\n\n### Example\nAvailable [here](https://github.com/abiosoft/ishell/blob/master/example/main.go).\n```sh\ngo run example/main.go\n```\n\n## Supported Platforms\n* [x] Linux\n* [x] OSX\n* [x] Windows [Not tested but should work]\n\n## Note\nishell is in active development and can still change significantly.\n\n## Roadmap (in no particular order)\n* [x] Multiline inputs\n* [x] Command history\n* [x] Customizable tab completion\n* [x] Handle ^C interrupts\n* [x] Subcommands and help texts\n* [x] Scrollable paged output\n* [x] Progress bar\n* [x] Multiple choice prompt\n* [x] Checklist prompt\n* [x] Support for command aliases\n* [ ] Multiple line progress bars\n* [ ] Testing, testing, testing\n\n## Contribution\n1. Create an issue to discuss it.\n2. Send in Pull Request.\n\n## License\nMIT\n\n## Credits\nLibrary | Use\n------- | -----\n[github.com/flynn-archive/go-shlex](https://github.com/flynn-archive/go-shlex) | splitting input into command and args.\n[github.com/chzyer/readline](https://github.com/chzyer/readline) | readline capabilities.\n\n\n## Donate\n```\nbitcoin: 1GTHYEDiy2C7RzXn5nY4wVRaEN2GvLjwZN\npaypal: a@abiosoft.com\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fddvk%2Fishell","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fddvk%2Fishell","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fddvk%2Fishell/lists"}