clin is a command-line tool that simplifies the process of compiling and running code across various programming languages. It intelligently detects the language based on the file extension and acts as a wrapper around the appropriate compiler or interpreter.
Key Features:
- Automatic Language Detection: Runs the correct compiler or interpreter based on the input file's extension.
- Universal
-oFlag: Specifies the output path for compiled binaries. - Pass-through Flags: Unknown flags are directly passed to the underlying compiler or interpreter.
- Default Execution: By default,
clincompiles (if necessary) and runs the resulting binary located in a temporary OS-dependent directory (/tmp). - Customizable Behavior:
-o <path>: Specify the output path for the binary.-ot <path>: Specify the output path but do not execute the binary.-t: Do not execute the binary after compilation.
Supported Languages:
clin currently supports the following programming languages:
- C (
.c) - C++ (
.cpp) - Python (
.py) - Go (
.go) - Zig (
.zig) - Rust (
.rs) - Java (
.java) - Swift (
.swift) - Fortran 90 (
.f90) - Fortran 95 (
.f95) - Fortran 77 (
.f) - Fortran 2003 (
.f03) - Fortran 2008 (
.f08) - Fortran (other extensions) (
.for) - Haskell (
.hs) - Ruby (
.rb) - Perl (
.pl) - PHP (
.php) - Lua (
.lua) - JavaScript (
.js) - TypeScript (
.ts)
With clin, you can seamlessly compile and run your code without needing to remember the specific commands for each language.
- Requires sudo privilages
curl https://raw.githubusercontent.com/bashmyhed/clin/refs/heads/main/scripts/install.sh | sudo bash
Follow these steps to install clin using the batch script provided in the repository:
Click the link below to download the installer batch file:
Tip: Right-click the link above and choose "Save link as..." to save it locally.
After downloading:
- Right-click the
install.batfile. - Select "Run as administrator" from the context menu.
- Windows may show a SmartScreen warning about running the file.
- Click More info
- Then click Run anyway
This will open a PowerShell window and guide you through the installation steps.
Running as administrator is required to install the binary to
C:\Program Files\clinand modify the systemPATH.
After installation:
- The
clinbinary will be placed inC:\Program Files\clin\clin.exe - The folder will be added to your system
PATH - Windows Defender will be configured to exclude the folder (if possible)
You may need to restart your terminal or PowerShell for the changes to take effect.
Usage:
clin [options] <source-file> [build flags]
-vor--version— print the clin version-hor--help— Show this help message--verbose— enable verbose output (useful for debugging)-o <file>— Set the output binary file path-ot <file>— Set the output path for the binary but do not run it after building-t— do not run the binary after compilation (useful for not running Java classes)--build— Everything after this option is considered build flags and will be passed directly to the underlying compiler or interpreter. This option is not strictly necessary but can be used for clarity.
clin -o bin/myapp test.cCompiletest.cand save the executable asbin/myapp.clin -ot bin/myapp hello.cppCompilehello.cppand save the executable asbin/myapp, but do not run it.clin script.pyRun the Python scriptscript.py.clin --build "-Wall -O2" mycode.cCompilemycode.cwith the build flags-Walland-O2. The output binary will be created in the default temporary location and run.clin -u myscript.py --input data.txt --verbose -n 5Run the Python scriptmyscript.py, passing the arguments-u --input data.txt --verbose -n 5directly to the interpreter.clin myscript.py --build "-u --input data.txt --verbose -n 5"Run the Python scriptmyscript.py, treating-u --input data.txt --verbose -n 5as build flags passed to the interpreter. Note the quoting to treat them as a single argument to--build.
- Does not support flags like -d in java and similar, it ll still work but you will get error during runtime use -t & -ot flag for such cases
- compilers/interpreters for specific languages are hoardcoded. I will add support for clinrc file to solve that issue
- No support for runtime arguments or flags, same with runner flags like flag for java somethin.class
- Could be optimised for efficient logic.