Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/proffapt/code-runner

Implementation of code-runner in bash for compiling code files and executing them with one and only command
https://github.com/proffapt/code-runner

autmate-compilation automate-execution automation bash c-cpp code code-runner compile-and-run compile-and-run-code compile-code compile-run execute-code hacktoberfest java-runner python-version-selector run-code runner

Last synced: about 2 months ago
JSON representation

Implementation of code-runner in bash for compiling code files and executing them with one and only command

Awesome Lists containing this project

README

        

[![Contributors][contributors-shield]][contributors-url]
[![Forks][forks-shield]][forks-url]
[![Stargazers][stars-shield]][stars-url]
[![Issues][issues-shield]][issues-url]
[![MIT License][license-shield]][license-url]
[![LinkedIn][linkedin-shield]][linkedin-url]

code-runner


execute code files with ease


Explore the docs ยป




Report Bug
ยท
Request Feature

Table of Contents



  1. About The Project



  2. Getting Started




  3. Usage


  4. Integrating with vscode

  5. Integrating with vim

  6. Contact

  7. Acknowledgments

  8. Miscelleneous

## About The Project

This is a script, which compiles the code file and run it for you and delete other _junk_ files if created during the process of compilation, all this with one command for all the languages supported by it. No more remembering different arguments for different compilers to compile, execut and debug the code.

### Why this Code Runner?

- Can detect correct version of python with 90% accuracy.
- Has inbuilt debugger support.
- Custom made keybindings for [vim](#integrating-with-vim) and [vscode](#integrating-with-vscode).
- Robust code, deals with all possible cases.
- Can execute files with spaces in their names.
- Can execute from any location.
- Automatically cleans executable files by default.
- Highest number of languages supported compared to its alternatives.

(back to top)

## Getting Started

### Installation

_To install and configure the project on your system locally, use suitable method:_

- [Using curl](#install-using-curl)
- [Using brew](#install-using-brew)

#### Install using CURL

1. Copy and run the following command to install the run binary on your system.

```sh
curl https://raw.githubusercontent.com/proffapt/code-runner/main/.setup/install.sh | bash
```
2. Run the code
```sh
run my_code.c
```
OR
```sh
run ~/path/to/my_code.c
```

#### Install using BREW

```bash
brew tap proffapt/brewtap
brew install code-runner
```

(back to top)

### Uninstallation

_To uninstall the tool from your system execute the following command, depending upon your installation_

- [Using curl](#uninstall-using-curl)
- [Using brew](#uninstall-using-brew)

#### Uninstall using CURL

```sh
curl https://raw.githubusercontent.com/proffapt/code-runner/main/.setup/uninstall.sh | bash
```

#### Uninstall using BREW
```bash
brew uninstall code-runner
```

(back to top)

## Usage



image

(back to top)

### Examples

* Compilation and Execution

image
* Debugging

image
* Python

image

(back to top)

## Integrating with vscode

Create custom keybindings for `vscode` to use this script more conveniently in vscode, you can copy my keybindings from [vscode-keybindings](https://github.com/proffapt/code-runner/blob/main/keybindings/vscode-keybindings) into your keybindings.json

* `alt+space`

- **If there is no instance of terminal**: Spawns a new terminal `>` shifts the focus to it.
- **If the instance already exists and focus is on editor pane**: Focuses the terminal.
- **If the focus is on terminal**: Focuses the editor pane keeping the terminal at it's place.

* `cmd+contextmenu` -- use twice for execution

- **If there is no terminal instance**: Spawns a new terminal `>` shifts focus to it(DOESN"T EXECUTE THE CODE, press again to execute the code).
- **If instance exists and focus is on editor pane**: Shifts focus to terminal(DOESN"T EXECUTE THE CODE, press again to execute the code).
- **If the focus is on terminal**: Executes the code.

^ **NOTE**: Code execution is also possible even if the code file is not directly inside the folder opened in vscode.

>> _Stores previous execution history, as there is no new terminal created everytime, it's created only when not present else uses the same terminal_

https://user-images.githubusercontent.com/86282911/204466533-977280fc-a1a7-492f-bf91-9090d5c70cf4.mp4

(back to top)

## Integrating with vim

Create custom keybindings for `{Neo}vim` to use this script more conveniently in `{Neo}vim`, you can copy my keybindings from the following files to your vim configuration file.

- [For .{n}vimrc type configs](https://github.com/proffapt/code-runner/blob/main/keybindings/vim-keybindings-rc)
- [For lua type configs](https://github.com/proffapt/code-runner/blob/main/keybindings/vim-keybindings-lua)

* `rr`

- In NORMAL mode: Saves the file `>` creates a new floaterm buffer `>` shifts focus to it `>` runs the code(CLOSE the buffer with any key after completion of execution).

>> _Doesn't store previous execution history, as there is a new buffer created everytime_

* `ff`

- **In NORMAL mode with no existing floaterm buffer**: Saves the file `>` creates a new floaterm buffer `>` shifts focus to it `>` runs the code.
- **In NORMAL mode with existing floaterm buffer but focus on code buffer**: Saves the file `>` shifts focus to floaterm buffer `>` runs the code.
- **In NORMAL mode with existing floaterm buffer and focus on flaoterm buffer**: Hides the floaterm buffer `>` focuses on the working file's buffer.
- **In TERMINAL mode**: Hides active floaterm buffer `>` focuses on the working file's buffer.

>> _Stores previous execution history, as there is no new buffer created everytime, it's created only when not present else uses the same buffer_

https://user-images.githubusercontent.com/86282911/204343876-fa160388-ba4c-47be-88a0-16c6f7e7c1cb.mp4

(back to top)

## Contact


๐Ÿ“ซ Arpit Bhardwaj ( aka proffapt ) -


proffapt's Twitter


proffapt's Telegram


proffapt's LinkedIn


proffapt's mail


proffapt's forum for cybernity

(back to top)

## Acknowledgments

* [Choose an Open Source License](https://choosealicense.com)
* [Img Shields](https://shields.io)
* [Bash filename manipulation](https://stackoverflow.com/a/965069)

(back to top)

## Miscelleneous

Do consider looking at other paradigms of this documentation
- [Change-logs](CHANGELOG.md)
- [License used](LICENSE.txt)
- [Code Of Conduct](CODE_OF_CONDUCT.md)
- [How to contribute?](CONTRIBUTING.md)

(back to top)

[contributors-shield]: https://img.shields.io/github/contributors/proffapt/code-runner.svg?style=for-the-badge
[contributors-url]: https://github.com/proffapt/code-runner/graphs/contributors
[forks-shield]: https://img.shields.io/github/forks/proffapt/code-runner.svg?style=for-the-badge
[forks-url]: https://github.com/proffapt/code-runner/network/members
[stars-shield]: https://img.shields.io/github/stars/proffapt/code-runner.svg?style=for-the-badge
[stars-url]: https://github.com/proffapt/code-runner/stargazers
[issues-shield]: https://img.shields.io/github/issues/proffapt/code-runner.svg?style=for-the-badge
[issues-url]: https://github.com/proffapt/code-runner/issues
[license-shield]: https://img.shields.io/github/license/proffapt/code-runner.svg?style=for-the-badge
[license-url]: https://github.com/proffapt/code-runner/blob/master/LICENSE.txt
[linkedin-shield]: https://img.shields.io/badge/-LinkedIn-black.svg?style=for-the-badge&logo=linkedin&colorB=555
[linkedin-url]: https://linkedin.com/in/proffapt