{"id":17382269,"url":"https://github.com/fcard/fxcrd","last_synced_at":"2026-02-27T15:03:08.802Z","repository":{"id":95703726,"uuid":"83363076","full_name":"fcard/Fxcrd","owner":"fcard","description":"I had a really bad fever and decided to make a unix shell macro language","archived":false,"fork":false,"pushed_at":"2017-08-24T13:36:34.000Z","size":29,"stargazers_count":0,"open_issues_count":5,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-12T20:27:08.247Z","etag":null,"topics":["julia-language","macros","shell","stupid"],"latest_commit_sha":null,"homepage":null,"language":"Julia","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/fcard.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":"2017-02-27T22:21:10.000Z","updated_at":"2017-02-28T00:11:50.000Z","dependencies_parsed_at":"2023-03-10T15:15:59.353Z","dependency_job_id":null,"html_url":"https://github.com/fcard/Fxcrd","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/fcard%2FFxcrd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fcard%2FFxcrd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fcard%2FFxcrd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fcard%2FFxcrd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fcard","download_url":"https://codeload.github.com/fcard/Fxcrd/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247492763,"owners_count":20947584,"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":["julia-language","macros","shell","stupid"],"created_at":"2024-10-16T07:36:03.489Z","updated_at":"2025-11-03T13:03:22.966Z","avatar_url":"https://github.com/fcard.png","language":"Julia","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Fxcrd\n\nThis lets you write macros in shell scripts\n\nI was sick and bored and I don't care god\n\nIt took me three days to realize that the name was just my username with a x in it minus a letter.\nwhatever it worked for linus\n\nI will eventually make this less of a mess. Hopefully.\n\n# Install\n\nClone this somewhere.\n```sh\n$ git clone https://github.com/fcard/Fxcrd\n```\nUse the install.sh, it's interactive and obnoxious.\n```sh\n$ ./install.sh\nWelcome and blah blah I will ask a few questions and we will install this thing\nBut wait there's more!\n```\nThe above does only a half assed job and you need to add this to your .zshrc/.bashrc whatever\n```sh\n. $(fxcrd_path)/init\n```\nI think that's it but I don't know.\nAlso don't move the cloned directory anywhere else or everything will break.\n\nOh yeah, there are two backends for the macro expander, a slow and probably buggy `sh` one, and \na `julia` one which I spent most of my time on. I suggest the latter but you need `julia 0.6` which isn't\neven out yet. Good. (install.sh will ask you which you want)\n\nNext time I get a cold I will probably add more backends.\n\n# Compiling\n\nPut your code files in the `$(fxcrd_path)/include` directory and they will be compiled next time you open your shell.\nOr you can also do:\n```\n$ fxcrd_compile \"/path/to/file\"\n```\nCompiled files will be put in the `$(fxcrd_path)/compiled` directory and will be loaded automatically.\n\n# The code files and their macros\n\nCode files are just shell scripts but you can do\n```\n@macro name\n  @code\n    echo $1\n  @end\n@end\n\n@name 1 @@\n```\nand that will compile to\n```sh\necho 1\n```\n\n`$(fxcrd_path)/include/local_function`:\n```sh\n\n@macro local_function\n  local name=$1\n  local body=\"$(cat)\"\n  \n  local prefix=\"$(\u003c/dev/urandom tr -cd '[:alnum:]' | head -c 32)\"\n  \n  @code\n    __${prefix}__${name}(){\n      $body\n    }\n    local $name=\"__${prefix}__${name}\"\n  @end\n@end\n\nf() {\n  @local_function g\n    echo $1\n  @end\n  \n  $g 10\n}\n\nf\n#g ins't here that's the point of the example\n```\n\n`$(fxcrd_path)/compiled/\u003csome_giberish\u003e%%local_function`:\n```sh\nf() {\n__kqhqAl2r2qkyx58LV3aQjtuEhcJjS8Ap__g(){\n   echo $1\n}\nlocal g=\"__kqhqAl2r2qkyx58LV3aQjtuEhcJjS8Ap__g\"\n  \n  $g 10\n}\n\nf\n#g ins't here that's the point of the example\n```\n\n```sh\n$ sh $(fxcrd_path)/compiled/\u003csome_giberish\u003e%%local_function\n10\n```\nYa get the idea?\n\nThere are two types of macro calls:\n```sh\n@name arg1 arg2 arg3 @@everything here will be read as input.\n```\n```sh\n@name arg1 arg2 arg3\n  every here\n  will be read\n  as input\n  you fool\n@end\n```\nSome indentation shenanigans going on in the multiline form\n```\n@macro name @@echo $(cat)\n\n@name\n  10\n@end\n```\nbecomes:\n```\n10\n```\ninstead of:\n```\n  10\n```\nAnd that's about it.\n\nOh yeah, `fxcrd_i` starts an interactive session: (needs julia)\n```sh\n[fabio:...ripts/ShellExtensions/fxcrd]$ fxcrd_i                                         (master) \n\n  ------------------\n   --- hello !! --- \n  ------------------\n\n[---]==\u003e echo 10\n|/\n| 10\n|\\\n[---]==\u003e @macro m\n[---] \u003e\u003e   echo \"echo 10\"\n[---] \u003e\u003e @end\n[---]==\u003e @m @@\n|/\n| 10\n|\\\n[---]==\u003e .expand\n[e--]==\u003e @m @@\n|/\n| echo 10\n|\\\n[e--]==\u003e .help\n  .q | .quit       == end session\n  .e | .expand     == toggles if macros are expanded or evaluated\n  .t | .token      == shows tokens of input line\n  .c | .call       == shows macrocall analysis\n  .l | .list       == list macros\n  .s | .stacktrace == show last stacktrace from a julia error\n  .h | .help       == this help text\n\n[e--]==\u003e .quit\n bye bye!\n \n[fabio:...ripts/ShellExtensions/fxcrd]$ echo I was in a better mood when I made it      (master) \nI was in a better mood when I made it\n```\nThere was also a thing where if you had the julia backend you could create macros with julia code\n```\n@macro jlm -j\n  println(\"echo 10\")\n@end\n```\nBut there is some weird shit about \"world age\" in the error messages and I need some sleep\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffcard%2Ffxcrd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffcard%2Ffxcrd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffcard%2Ffxcrd/lists"}