All Projects → Luavis → sherlock.py

Luavis / sherlock.py

Licence: MIT license
Sherlock is transpiler that translate python to shell script language.

Programming Languages

python
139335 projects - #7 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to sherlock.py

Pseudo Python
a restricted python to javascript / c# / go / ruby compiler
Stars: ✭ 106 (+63.08%)
Mutual labels:  transpiler
Rosid
Just-in-time development server and static site generator.
Stars: ✭ 139 (+113.85%)
Mutual labels:  transpiler
Transcrypt
Python 3.7 to JavaScript compiler - Lean, fast, open! -
Stars: ✭ 2,502 (+3749.23%)
Mutual labels:  transpiler
Elixirscript
Converts Elixir to JavaScript
Stars: ✭ 1,504 (+2213.85%)
Mutual labels:  transpiler
C2go
⚖️ A tool for transpiling C to Go.
Stars: ✭ 1,736 (+2570.77%)
Mutual labels:  transpiler
Rapydscript Ng
A transpiler for a Python like language to JavaScript
Stars: ✭ 140 (+115.38%)
Mutual labels:  transpiler
Powscript
transpiler written in bash: painless shellscript, indentbased, coffee for the shell with hipster-sparkles v1 BETA LANDED 🎉🎉🎉🎉 thanks fcard!
Stars: ✭ 97 (+49.23%)
Mutual labels:  transpiler
Moonscript
🌙 A language that compiles to Lua
Stars: ✭ 2,694 (+4044.62%)
Mutual labels:  transpiler
Webpack Babel Env Deps
Find dependencies to transpile with Babel.
Stars: ✭ 130 (+100%)
Mutual labels:  transpiler
Rockstar Js
JavaScript transpiler for the esoteric language 'Rockstar'
Stars: ✭ 189 (+190.77%)
Mutual labels:  transpiler
Crossshader
⚔️ A tool for cross compiling shaders. Convert between GLSL, HLSL, Metal Shader Language, or older versions of GLSL.
Stars: ✭ 113 (+73.85%)
Mutual labels:  transpiler
Rbql
🦜RBQL - Rainbow Query Language: SQL-like language for (not only) CSV file processing. Supports SQL queries with Python and JavaScript expressions
Stars: ✭ 118 (+81.54%)
Mutual labels:  transpiler
Aesara
Aesara is a fork of the Theano library that is maintained by the PyMC developers. It was previously named Theano-PyMC.
Stars: ✭ 145 (+123.08%)
Mutual labels:  transpiler
Godzilla
Godzilla is a ES2015 to Go source code transpiler and runtime
Stars: ✭ 1,464 (+2152.31%)
Mutual labels:  transpiler
Plus
This project is being developed privately.
Stars: ✭ 215 (+230.77%)
Mutual labels:  transpiler
Babel Preset Github
GitHub.com's Babel configuration
Stars: ✭ 103 (+58.46%)
Mutual labels:  transpiler
Swiftrewriter
A Swift Package Manager console app and library to convert Objective-C code into Swift.
Stars: ✭ 140 (+115.38%)
Mutual labels:  transpiler
C4go
Transpiling C code to Go code
Stars: ✭ 253 (+289.23%)
Mutual labels:  transpiler
Retyped
Access 3600+ libraries from C# and let Bridge.NET compile your project into JavaScript.
Stars: ✭ 216 (+232.31%)
Mutual labels:  transpiler
C2rust
Migrate C code to Rust
Stars: ✭ 2,111 (+3147.69%)
Mutual labels:  transpiler

wip pypi pypi-version travis-ci Code Climate Test Coverage Open Source Love

sherlock.py

Sherlock.py is transpiler that translate python to bash shell script language.

한국어로 보기

Motivation

map to buried treasure

< Ditective who program with Shell script >

Shell script is well known script language which is used in most of unix-like OS. Shell script lanuage garuntee to run in most unix-like OS. So many software developers are using this language when they program install script or configuration script. Because this language is really old, There are several problems. and it is hard to maintain program which is writted by shell script language.

Install

$ pip install sherlock.py

Sherlock.py supports python version over 2.6 or 3.3. and support linux and macOS. If there is error in install please write issue.

Usage

usage: sherlock [-h] [-o output] [-c] [-v] [--version] [file | command]

Python to bash trans-compiler.

positional arguments:
  [file | command]  program read from script file

optional arguments:
  -h, --help        show this help message and exit
  -o output         output file path
  -c, --command     program passed in as string
  -v, --verbose     program run in verbose mode
  --version         show program's version number and exit

Following is basic usage.

$ sherlock target.py

Using this command, target.py file is translated into bash shell sciprt. after, it is automatically run with sh. We can find out bug from the running result.

$ sherlock target.py -o output.sh

Using -o flag, you can save sherlock result in file. In this case script isn't run automatically.

$ sherlock -c "echo 'Hello World.'"

Using -c flag, input command is immediately translated to bash shell script language and executed.

If you want to details. Please check sample codes

Library

sherlock.cmd package

You can use general shell command importing from sherlock.cmd. When you import package, it check user already installed command and create wrap function which return stdout output.

from sherlock.cmd import ls
ls('-al')

pipe function

In shell script, you can combine command with | operator. To do same thing in python, Sherlock.py support pipe function.

from sherlock.cmd import wc
pipe(print('./test'), wc('-c'))

Todo

  • import syntax
  • support ksh/POSIX-strict
  • command package
  • documentation
  • support windows batch and powershell script
  • more test...

License

  • MIT © 2017 Luavis
  • Icon designed by cyoh, Sherlock Holmes graphic by Matthew Davis from the Noun Project
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].