{"id":23533089,"url":"https://github.com/imarsman/gotee","last_synced_at":"2025-05-14T16:34:43.785Z","repository":{"id":57705881,"uuid":"402782501","full_name":"imarsman/gotee","owner":"imarsman","description":"An implementation of tee in Go. Supports -a option and writes to one or more files. Can avoid sending to stdout with -S option. With no stdin will accept keyboard input.","archived":false,"fork":false,"pushed_at":"2021-09-08T02:56:25.000Z","size":261,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-17T05:11:16.707Z","etag":null,"topics":["golang","tee"],"latest_commit_sha":null,"homepage":"","language":"Go","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/imarsman.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}},"created_at":"2021-09-03T13:38:28.000Z","updated_at":"2022-01-06T20:10:02.000Z","dependencies_parsed_at":"2022-08-24T10:40:46.572Z","dependency_job_id":null,"html_url":"https://github.com/imarsman/gotee","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/imarsman%2Fgotee","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imarsman%2Fgotee/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imarsman%2Fgotee/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imarsman%2Fgotee/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/imarsman","download_url":"https://codeload.github.com/imarsman/gotee/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254183302,"owners_count":22028471,"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":["golang","tee"],"created_at":"2024-12-25T23:13:46.526Z","updated_at":"2025-05-14T16:34:43.754Z","avatar_url":"https://github.com/imarsman.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tee (gotee)\nAn implementation of tee in Go.\n\nThis program, an implementation of the tee command, first available in 1974,\ntakes in standard input and for each file specified either appends or writes to\neach file until the standard input is done. As it does so it passes out what is\nread to standard output.\n\nThe `tee` command is a handy way, and one of the only ways to branch standard\ninput to save to one or more files and to reproduce standard input as standard\noutput for consumers down the line.  Additionally, to allow for the avoidance of\nredirecting standard output to /dev/null, the `-S` option allows for the\navoidance of carry-over of standard input to standard output. This is not\nsomething I have seen on any other implementations.\n\n## Usage\n\n* `gotee -h` print usage\n* `gotee` no files specified - use keyboard input instead of stdin and exit on\n  Control-C\n* `gotee \u003cfile1\u003e \u003cfile2\u003e` - write to one or more files specified as last arguments\n* `gotee -a \u003cfile\u003e \u003cfile\u003e` - append to existing files and if not existing create\n  new files\n* `gotee -S \u003cfile\u003e \u003cfile\u003e` - do not forward standard input to standard output\n* `gotee -i` - ignore interrupt. Not implemented but is in original tee\n  * I don't quite know what to do with this. If an interrupt is received that\n    means that whatever is piping to standard input would have been shut down\n    and therefore there would be no standard input to recieve. I would be happy\n    to be corrected on this. In theory I could make the loop through standard\n    input a function internal to main and restart that function on interrupt,\n    but I don't see the point of that. What I have done is in all cases\n    intercept an interrupt signal and shut things down as gracefully as\n    possible.\n\n## Notes\n\nThe official `tee` waits for stdin even when nothing has been sent to it. I've\nadded support for waiting on keyboard input for string data. Control-C works to\nexit this. So although this is reading input as a string, this is likely not\nharmful. The main stdin reader reads in bytes and thus can handle `cat test.jpg\n| gotee -S out.jpg`.\n\nThis works to mimic `command | gotee -S out.txt`\n\n`command | dd status=none of=out.txt`\n\n## Notes\n\nThe argument parsing library used here does not deal with arguments such as -1,\n-2, -, etc. It may be that an argument will need to have a different identifier to\nwork around this.\n\n-- Ian Marsman\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimarsman%2Fgotee","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fimarsman%2Fgotee","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimarsman%2Fgotee/lists"}