{"id":25082609,"url":"https://github.com/yoavnir/specs","last_synced_at":"2025-07-27T15:37:10.818Z","repository":{"id":151136578,"uuid":"94824445","full_name":"yoavnir/specs","owner":"yoavnir","description":"A re-writing of the specs pipeline stage from CMS, only changed quite a bit","archived":false,"fork":false,"pushed_at":"2017-11-25T18:37:43.000Z","size":12,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-01T10:29:14.603Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","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/yoavnir.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-06-19T21:57:53.000Z","updated_at":"2017-06-19T22:02:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"4b5a4cb0-ac12-4623-a7a0-e022dd94fed6","html_url":"https://github.com/yoavnir/specs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/yoavnir/specs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yoavnir%2Fspecs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yoavnir%2Fspecs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yoavnir%2Fspecs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yoavnir%2Fspecs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yoavnir","download_url":"https://codeload.github.com/yoavnir/specs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yoavnir%2Fspecs/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267378292,"owners_count":24077715,"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-07-27T02:00:11.917Z","response_time":82,"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":"2025-02-07T05:32:12.248Z","updated_at":"2025-07-27T15:37:10.783Z","avatar_url":"https://github.com/yoavnir.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# specs\nA re-writing of the specs pipeline stage from CMS, only changed quite a bit\n\n\"specs\" is a command line utility for parsing and re-arranging text\ninput. It allows re-alignment of fields, some format conversion, and\nre-formatting multiple lines into single lines or vice versa. Input\ncomes from standard input, and output flows to standard output.\n\nThe command line format is as follows:\n\n  specs [switches] [spec-units]\n  \nswitches\n========\n  -ws word-separator-chars\n    determines what characters count as word separators. The default is\n    tab, space, newline and carriage-return. In the argument, \"\\t\" can \n    be used for tab, \"\\n\" can be used for the newline character, \"\\r\"\n    can be used for the carriage return, \"\\w\" can be used for all\n    three, and \"\\W\" for all three plus space (the defualt).\n    \n  -spc space-char\n    determines what character will be used as the space character when\n    padding output and separating output words. The default is space.\n    \n  -d\n    Allows debug output to standard error\n    \n  -dd\n    Allows a lot of debug output to standard error.\n    \nSpec Units\n==========\nEach spec unit specifies an action to be taken by the program. The spec\nunit may span from one to four command line arguments.\n\nThe ordinary spec unit consists of four arguments, two of which may be\nomitted:\n  source [conversion] dest [alignment]\n  \nThe \"source\" argument may be any of the following:\n  - A range of characters, such as 5, 3-7, or 5.8, the last one \n    indicating 8 characters starting in the 5th position. Note that the\n    indexing of characters is 1- rather than 0-based.\n  - A range of words, such as w5 or w5-7, and again the word indexing\n    is 1-based.\n  - timestamp - an OS formatted timestamp, giving the exact time when\n    the record was written.\n  - timediff - an 8-char decimal number indicating the number of \n    seconds since the invocation of the program.\n  - a string literal, optionally enclosed by single quotes. Note that\n    to include the single quotes on the command line required you to \n    enclose them in double quotes.\n    \nThe \"dest\" argument specifies where to put the source:\n  - absolute position (such as \"1\")\n  - range (such as 1-5 or 1.5)\n  - \"n\" (for \"next\") for placing the output immediately after the \n    previous output\n  - \"nw\" (for \"next word\") for placing the output following a space \n    character after the previous output\n    \nThe alignment argument can be 'l', 'c', or 'r', for \"left\", \"center\",\nand \"right\" respectively.\n\nThe conversion argument can specify any of the following conversions:\n - rot13 - encrypts the bytes using the ROT-13 cipher\n - x2d - converts hex data to decimal\n - d2x - converts decimal data to hex\n - b2x - converts binary data to hex\n - x2b - converts hex data to binary\n - x2bt - converts hex data to binary, padded with zeros to include all\n   nibbles.\n - ucase - converts text to uppercase\n - lcase - converts text to lowercase\n \nThere are also three special spec units, that may be used:\n  \"read\" - causes the program to read the next line of input\n  \"write\"- causes the program to write to output and reset the output \n      line.\n  \"redo\" - causes the program to use the line of output as the new \n      input, and reset the output line.\n      \nExample:\n  \"ls -l\" yields this:\ntotal 352\n-rw-r--r--@ 1 ynir  admin    574 Aug 25  2009 Makefile\n-rw-r--r--@ 1 ynir  admin   3542 Nov 23 00:21 README\n-rw-r--r--@ 1 ynir  admin    362 Nov 19 08:31 conversion.h\n-rw-r--r--  1 ynir  admin    984 Nov 11 17:45 ls.txt\n-rw-r--r--@ 1 ynir  admin   2233 Nov 23 00:03 main.cc\n-rw-r--r--  1 ynir  admin   9412 Nov 23 00:11 main.o\n-rw-r--r--@ 1 ynir  admin   6567 Nov 23 00:09 spec_build.cc\n-rw-r--r--  1 ynir  admin  16776 Nov 23 00:11 spec_build.o\n-rw-r--r--@ 1 ynir  admin   5494 Nov 19 08:30 spec_convert.cc\n-rw-r--r--  1 ynir  admin  17004 Nov 23 00:11 spec_convert.o\n-rw-r--r--@ 1 ynir  admin  11419 Nov 23 00:10 spec_params.cc\n-rw-r--r--  1 ynir  admin  21080 Nov 23 00:11 spec_params.o\n-rw-r--r--@ 1 ynir  admin    375 Nov 11 09:29 spec_vars.cc\n-rw-r--r--  1 ynir  admin   4800 Nov 23 00:11 spec_vars.o\n-rwxr-xr-x  1 ynir  admin  36740 Nov 23 00:11 specs\n-rw-r--r--@ 1 ynir  admin   1547 Nov 23 00:10 specs.h\n\nLet's run it though a spec:\n  ls -l | specs 12-x 1 redo w2 1 w4 d2x 8.8 r w8 17\nThe first spec unit converts it to this:\n 1 ynir  admin    574 Aug 25  2009 Makefile\n 1 ynir  admin   3542 Nov 23 00:21 README\n 1 ynir  admin    362 Nov 19 08:31 conversion.h\n 1 ynir  admin    984 Nov 11 17:45 ls.txt\n 1 ynir  admin   2233 Nov 23 00:03 main.cc\n 1 ynir  admin   9412 Nov 23 00:11 main.o\n 1 ynir  admin   6567 Nov 23 00:09 spec_build.cc\n 1 ynir  admin  16776 Nov 23 00:11 spec_build.o\n 1 ynir  admin   5494 Nov 19 08:30 spec_convert.cc\n 1 ynir  admin  17004 Nov 23 00:11 spec_convert.o\n 1 ynir  admin  11419 Nov 23 00:10 spec_params.cc\n 1 ynir  admin  21080 Nov 23 00:11 spec_params.o\n 1 ynir  admin    375 Nov 11 09:29 spec_vars.cc\n 1 ynir  admin   4800 Nov 23 00:11 spec_vars.o\n 1 ynir  admin  36740 Nov 23 00:11 specs\n 1 ynir  admin   1547 Nov 23 00:10 specs.h\n\nThen after the redo, we get this:\nynir        23e Makefile\nynir        dd6 README\nynir        16a conversion.h\nynir        3d8 ls.txt\nynir        8b9 main.cc\nynir       24c4 main.o\nynir       19a7 spec_build.cc\nynir       4188 spec_build.o\nynir       1576 spec_convert.cc\nynir       426c spec_convert.o\nynir       2c9b spec_params.cc\nynir       5258 spec_params.o\nynir        eae spec_vars.cc\nynir       12c0 spec_vars.o\nynir       8f84 specs\nynir        60b specs.h\n\n      \nAlternatively, let's arrange this on multiple lines:\n  ls -l | specs w9 1 write \"Owner:\" 3 w3 10 write \"Size:\" 3 w5 10-20 r\nMakefile\n  Owner: ynir\n  Size:          574\nREADME\n  Owner: ynir\n  Size:         5834\nconversion.h\n  Owner: ynir\n  Size:          362\nlist.txt\n  Owner: ynir\n  Size:          978\nls.txt\n  Owner: ynir\n  Size:          984\nmain.cc\n  Owner: ynir\n  Size:         2233\nmain.o\n  Owner: ynir\n  Size:         9412\n\nFinally, let's make our own version of the multi-column display:\n  ls -l | specs w9 1 read w9 26 read w9 51\n                         Makefile                 README\nconversion.h             main.cc                  main.o\nspec_build.cc            spec_build.o             spec_convert.cc\nspec_convert.o           spec_params.cc           spec_params.o\nspec_vars.cc             spec_vars.o              specs\n\nNote that the output is truncated. The last two entries did not appear, \nbecuase the spec unit \"read\" failed.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyoavnir%2Fspecs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyoavnir%2Fspecs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyoavnir%2Fspecs/lists"}