{"id":22912832,"url":"https://github.com/demindiro/qsh","last_synced_at":"2025-04-01T11:24:46.465Z","repository":{"id":137321528,"uuid":"457538671","full_name":"Demindiro/qsh","owner":"Demindiro","description":"Simple shell with JIT compilation","archived":false,"fork":false,"pushed_at":"2022-02-09T21:44:49.000Z","size":156,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-07T06:26:48.484Z","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":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Demindiro.png","metadata":{"files":{"readme":"README.md","changelog":null,"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}},"created_at":"2022-02-09T21:44:31.000Z","updated_at":"2024-09-26T09:53:46.000Z","dependencies_parsed_at":null,"dependency_job_id":"a334d699-abec-45a4-97d1-19a4e5955205","html_url":"https://github.com/Demindiro/qsh","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Demindiro%2Fqsh","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Demindiro%2Fqsh/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Demindiro%2Fqsh/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Demindiro%2Fqsh/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Demindiro","download_url":"https://codeload.github.com/Demindiro/qsh/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246629511,"owners_count":20808340,"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","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-12-14T04:29:55.831Z","updated_at":"2025-04-01T11:24:46.448Z","avatar_url":"https://github.com/Demindiro.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Quack Shell\n\n## Goals\n\n- Concise \u0026 simple syntax for executing functions \u0026 programs\n- Easy to define *and save* functions \u0026 variables (REPL-esque)\n- Make accidental security vulnerabilities hard (see `bash`)\n- Efficient piping of data between processes\n\n## Example\n\n```qsh\n#!/usr/bin/env qsh\n\nprint Files in directory:\n\nls \u003e\nsplit \u003c \u003e\nprint @\nfor file in @; (\n\tfile @file \u003etype\n\tif @file; print \"\u003e\" @file is @type\n)\n\nfn random \u003e\n\t@ = $4\n\nfn rand_either a b \u003er; (\n\trandom \u003e\n\texpr @ % 2 \u003e\n\tprintf %c @ \u003e\n\t@r = @a\n\tif test @ -eq 1\n\t\t@r = @b\n)\n\nprint random                      # Prints \"random\"\nrandom \u003e; print @                 # Calls the random function and prints the return value\nrand_either foo bar r\u003e; print @   # Prints either \"foo\" or \"bar\"\n\nprint 0000    # Prints 0000\nprint $0000   # Prints 0\nprint $xff    # Prints 255\n```\n\n## Specification\n\n**Note:** This specification is not yet complete and is subject to change.\nThe shell does not implement all features yet either.\n\n- Separators: `;`, `\\n`\n- Scope: `{ a; b; ...; ret }`\n  - A scope counts as a single statement\n  - The last value (`ret`) is returned\n  - Exiting early is possible with `return`\n- Variables: `@x = 5`, `print @x`\n- Whitespace outside quotes is ignored.\n\n\n### Types\n\n- Strings\n- Integers\n- Pipes\n- Arrays\n- Dictionaries (TODO)\n\n\n### Functions\n\nAll functions return an integer status code. Other return values can be\nextracted using pipes.\n\n\n### Streams\n\n**Note:** none of this is implemented. Output is collected into a string.\n\nThe main mechanism for exchanging data with programs are streams: data is\ncontinuously written and read from a stream.\n\nin `qsh`, streams and strings are identical from an abstract viewpoint. In\npractice they have different performance characteristics: while strings are\nstored entirely in memory, streams instead only buffer a portion of data at\nany time. This makes them ideal for exchanging a large amount of data.\n\nEstabilishing a stream from one program to another is done through pipes.\nEach pipe has exactly one input and one output, i.e.:\n\n```qsh\n# This is fine\nread a.txt 1\u003e\nwrite b.txt 1\u003c\n\n# The stream from `read a.txt` is lost\nread a.txt 1\u003e\nread b.txt 1\u003e\n\n# `write b.txt` will not write any data since `write a.txt` wrote all of it\nwrite a.txt 1\u003c\nwrite b.txt 1\u003c\n```\n\nA newly created pipe always has its input attached. If the input becomes\ndisconnected, the pipe becomes unusable.\n\n\n### Special variables\n\nTo keep scripts short, some variables automatically get a value assigned.\nThese variables cannot be assigned to directly.\n\n- `@?`: the return value of a call.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdemindiro%2Fqsh","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdemindiro%2Fqsh","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdemindiro%2Fqsh/lists"}