{"id":19238574,"url":"https://github.com/tmpfs/anticipate","last_synced_at":"2025-08-12T00:33:14.278Z","repository":{"id":222431459,"uuid":"757235156","full_name":"tmpfs/anticipate","owner":"tmpfs","description":"Script automation with asciinema support","archived":false,"fork":false,"pushed_at":"2024-02-24T06:10:07.000Z","size":354,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-16T02:28:29.998Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tmpfs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","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}},"created_at":"2024-02-14T04:19:16.000Z","updated_at":"2025-04-30T10:07:12.000Z","dependencies_parsed_at":"2024-02-18T05:28:18.954Z","dependency_job_id":"6b230845-2cd4-4e14-b3a1-1cbdd1edefb4","html_url":"https://github.com/tmpfs/anticipate","commit_stats":null,"previous_names":["tmpfs/anticipate"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tmpfs/anticipate","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmpfs%2Fanticipate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmpfs%2Fanticipate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmpfs%2Fanticipate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmpfs%2Fanticipate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tmpfs","download_url":"https://codeload.github.com/tmpfs/anticipate/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmpfs%2Fanticipate/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269980902,"owners_count":24507272,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-11T02:00:10.019Z","response_time":75,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":"2024-11-09T16:33:32.776Z","updated_at":"2025-08-12T00:33:14.157Z","avatar_url":"https://github.com/tmpfs.png","language":"Rust","readme":"# Anticipate\n\nScript based automation like `expect(1)` with support for [asciinema][].\n\nPerfect for demos and testing command line interfaces.\n\n## Install\n\n```\ncargo install anticipate-cli\n```\n\n## Example\n\nCreate a directory, initialize a server config, print the config file, start the server and then send SIGTERM to shut it down.\n\n```shell\nmkdir -p target/server/accounts\n#$ readline\n\nserver init target/config.toml --path server/accounts\n#$ readline\n\ncat target/config.toml\n#$ expect path = \"server/accounts\"\n\nserver start target/config.toml\n#$ sendcontrol ^C\n```\n\nSee the `examples` and `fixtures` folders for more examples.\n\n## Usage\n\n### Running\n\nTo execute scripts use the `run` command:\n\n```\nanticipate \\\n  run \\\n  --parallel \\\n  --log \\\n  tests/examples/*.sh\n```\n\n### Recording\n\nTo record using [asciinema][] writing a `.cast` file for each input file into the `target` directory overwriting any existing files:\n\n```\nanticipate \\\n  record \\\n  --parallel \\\n  --overwrite \\\n  --log \\\n  target \\\n  tests/examples/*.sh\n```\n\nSee the progam help for more options.\n\n## Syntax\n\n* [pragma](#pragma) - `#!/bin/bash`\n* [sendline](#send-line) - `#$ sendline ls -la`\n* [sendcontrol](#send-control) - `#$ sendcontrol ^C`\n* [expect](#expect) - `#$ expect Documents`\n* [regex](#regex) - `#$ regex [0-9]`\n* [readline](#read-line) - `#$ readline`\n* [sleep](#sleep) - `#$ sleep 500`\n* [send](#send) - `#$ send echo`\n* [flush](#flush) - `#$ flush`\n* [wait](#wait) - `#$ wait`\n* [clear](#clear) - `#$ clear`\n* [include](#include) - `#$ include ../shared.sh`\n\nEnvironment variables are interpolated for commands sent to the pseudo terminal which makes it easier to share values across scripts. \n\n```\nexport NAME=foo\nanticipate rec -o target tests/examples/interpolate.sh\nasciinema play target/interpolate.cast\n```\n\n### Pragma\n\nUse a pragma as the first instruction to set the command to execute:\n\n```\n#!/bin/bash\n```\n\nIf a relative path is given it is resolved relative to the script:\n\n```\n#!../programs/script.sh\n```\n\n### Send Line\n\nRaw text is sent as a line to the pseudo-terminal:\n\n```\nls -la\n```\n\nOr you can use the sendline command explicitly:\n\n```\n#$ sendline ls -la\n```\n\n### Send Control\n\nTo send a control character, for example Ctrl+C:\n\n```\n#$ sendcontrol ^C\n```\n\n### Expect\n\nExpect waits for a string to appear in the program output:\n\n```\n#$ expect Documents\n```\n\n### Regex\n\nTo wait for a pattern to appear in the program output use `regex`:\n\n```\n#$ regex [0-9]\n```\n\n### Read Line\n\nRead a line of program output:\n\n```\n#$ readline\n```\n\n### Sleep\n\nWait for a number of milliseconds:\n\n```\n#$ sleep 500\n```\n\n### Send\n\nSend text to the program without flushing the stream:\n\n```\n#$ send echo\n```\n\n### Flush\n\nFlush the buffer being sent to the pseudo-terminal:\n\n```\n#$ flush\n```\n\n### Wait\n\nWait for the prompt to appear:\n\n```\n#$ wait\n```\n\n### Clear\n\nClear the screen and reset the cursor position:\n\n```\n#$ clear\n```\n\n### Include\n\nInclude instructions from a script file:\n\n```\n#$ include ../shared.sh\n```\n\nPaths are resolved relative to the parent directory of the script file.\n\n## See Also\n\n* [Autocast](https://github.com/k9withabone/autocast) if you prefer a YAML syntax\n* [Asciinema Integrations](https://docs.asciinema.org/integrations/) for other asciinema tools \n\n## Credits\n\nThe [core](/core) module is a fork of [expectrl](https://github.com/zhiburt/expectrl/) and the syntax is inspired by [asciinema-automation](https://github.com/PierreMarchand20/asciinema_automation/).\n\n## License\n\nMIT or Apache-2.0\n\n[asciinema]: https://asciinema.org/\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftmpfs%2Fanticipate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftmpfs%2Fanticipate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftmpfs%2Fanticipate/lists"}