{"id":17383667,"url":"https://github.com/luavis/sherlock.py","last_synced_at":"2025-04-15T10:03:29.084Z","repository":{"id":57466770,"uuid":"77433949","full_name":"Luavis/sherlock.py","owner":"Luavis","description":"Sherlock is transpiler that translate python to shell script language.","archived":false,"fork":false,"pushed_at":"2017-02-24T18:55:07.000Z","size":96,"stargazers_count":68,"open_issues_count":5,"forks_count":8,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-15T10:03:09.539Z","etag":null,"topics":["python","shell-script","transpiler"],"latest_commit_sha":null,"homepage":"","language":"Python","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/Luavis.png","metadata":{"files":{"readme":"README.ko.rst","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":"2016-12-27T07:08:37.000Z","updated_at":"2025-03-28T09:13:13.000Z","dependencies_parsed_at":"2022-09-19T08:00:21.042Z","dependency_job_id":null,"html_url":"https://github.com/Luavis/sherlock.py","commit_stats":null,"previous_names":["luavis/sherlock"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Luavis%2Fsherlock.py","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Luavis%2Fsherlock.py/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Luavis%2Fsherlock.py/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Luavis%2Fsherlock.py/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Luavis","download_url":"https://codeload.github.com/Luavis/sherlock.py/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249048725,"owners_count":21204306,"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":["python","shell-script","transpiler"],"created_at":"2024-10-16T07:43:27.068Z","updated_at":"2025-04-15T10:03:29.059Z","avatar_url":"https://github.com/Luavis.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"|wip| |pypi| |pypi-version| |travis-ci| |Code Climate| |Test Coverage| |Open Source Love|\n\n.. image:: http://i.imgur.com/n8xH4Wd.png?1\n   :target: https://github.com/Luavis/sherlock\n   :align: center\n   :alt: sherlock.py\n\n**Sherlock.py**  Python으로 작성한 코드를 shell script언어로 바꿔주는 transpiler입니다.\n\n`English \u003chttps://github.com/Luavis/sherlock/tree/master/README.rst\u003e`_\n\n.. contents::\n\nMotivation\n----------\n\n.. figure:: http://i.imgur.com/7blJGwc.jpg\n    :alt: map to buried treasure\n    :width: 100%\n    :align: center\n\n    \u003c Shell script를 작성하는 명탐정의 모습 \u003e\n\nShell script는 많은 Unix-like 운영체제에서 보편적으로 사용되는 script language입니다. 이 언어는 Unix-like 운영체제에서 동작이 보장되어 많은 사람들이 Install script나 configure 스크립트에 사용됩니다. 하지만 개발된지 오래되어 다양한 `문제가 \u003chttp://teaching.idallen.com/cst8207/16w/notes/740_script_problems.html\u003e`_ 있고 유지보수가 어렵습니다.\n\nInstall\n-------\n\n.. code:: sh\n\n    $ pip install sherlock.py\n\nSherlock.py는 python버전 2.6 이상, 3.3 이상에서 동작을 보장하고 Linux 계열\n운영체제와 macOS에서 동작을 보장합니다. 해당 버전과 운영체제에 대해서 문제가 있으면 issue를 남겨주세요.\n\nUsage\n-----\n\n::\n\n    usage: sherlock [-h] [-o output] [-c] [-v] [--version] [file | command]\n\n    Python to bash trans-compiler.\n\n    positional arguments:\n      [file | command]  program read from script file\n\n    optional arguments:\n      -h, --help        show this help message and exit\n      -o output         output file path\n      -c, --command     program passed in as string\n      -v, --verbose     program run in verbose mode\n      --version         show program's version number and exit\n\n다음은 기본적인 사용 예제입니다.\n\n.. code:: sh\n\n    $ sherlock target.py\n\n위 커맨드를 사용하면 target.py를 shell script로 컴파일하고 이를 ``sh``\n명령어를 이용하여 실행합니다. 실행 결과를 통해서 내가 작성하고 있는\n코드가 shell script로 잘 컴파일 되는지 확인하고 디버깅할 수 있습니다.\n\n.. code:: sh\n\n    $ sherlock target.py -o output.sh\n\n``-o``\\ 플래그를 통해 sherlock의 결과물을 파일로 저장할 수 있습니다. 이 경우 유저가 작성한 스크립트가 실행되지 않습니다.\n\n.. code:: sh\n\n    $ sherlock -c \"echo 'Hello World.'\"\n\n``-c``\\ 플래그를 사용하면 입력한 커맨드가 즉시 ``sh``로 컴파일 되고 이를 실행합니다.\n\n자세한 사용예는 `samples \u003chttps://github.com/Luavis/sherlock.py/tree/master/samples\u003e`__ 에서 확인해주세요\n\nLibrary\n-------\n\n**sherlock.cmd package**\n\n일반적인 쉘 명령어를 ``sherlock.cmd``를 import하여 쓸 수 있습니다. 이 패키지를 import하게 되면, Sherlock.py로 만들어진 쉘 스크립트 코드를 실행하는 유저의 환경에 해당 명령어가 설치되어 있는지 미리 확인합니다.\n\n.. code:: python\n\n    from sherlock.cmd import ls\n\n    ls('-al')\n\n**pipe function**\n\n쉘 스크립트에서는 ``|``를 통해서 명령어를 연결할 수 있습니다. 이를 Python code로 구현하기 위해서, Sherlock.py에서는 pipe 함수를 지원합니다.\n\n.. code:: python\n\n    from sherlock.cmd import wc\n    pipe(print('./test'), wc('-c'))\n\nTodo\n----\n\n* import 구문\n* ``command`` 패키지 구현\n* 문서화\n* Windows BATCH/Powershell 스크립트 지원\n* 더 많은 테스트\n\nLicense\n-------\n\n- MIT © 2017 `Luavis \u003chttps://github.com/Luavis\u003e`__\n- Icon designed by `cyoh \u003chttps://github.com/cyoh\u003e`_, Sherlock Holmes graphic by Matthew Davis from the Noun Project\n\n.. |wip| image:: https://img.shields.io/badge/status-WIP-red.svg\n.. |pypi| image:: https://img.shields.io/pypi/v/sherlock.py.svg\n   :target: https://pypi.python.org/pypi/sherlock.py\n.. |pypi-version| image:: https://img.shields.io/pypi/pyversions/sherlock.py.svg\n   :target: https://pypi.python.org/pypi/sherlock.py\n.. |travis-ci| image:: https://travis-ci.org/Luavis/sherlock.py.svg?branch=master\n   :target: https://travis-ci.org/Luavis/sherlock.py\n.. |Code Climate| image:: https://codeclimate.com/github/Luavis/sherlock/badges/gpa.svg\n   :target: https://codeclimate.com/github/Luavis/sherlock\n.. |Test Coverage| image:: https://codeclimate.com/github/Luavis/sherlock/badges/coverage.svg\n   :target: https://codeclimate.com/github/Luavis/sherlock/coverage\n.. |Open Source Love| image:: https://badges.frapsoft.com/os/mit/mit.svg?v=102\n   :target: https://github.com/luavis/sherlock/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluavis%2Fsherlock.py","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fluavis%2Fsherlock.py","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluavis%2Fsherlock.py/lists"}