Run context-aware commands from your source code comments.
Codeline allows you to run custom commands directly from source-code comments, combining the power of IDE extensions with the expressiveness of the command-line.
Current State
Codeline is functional, and there are two working commands so far (see below). However, it is still in the very-early stages of development.
Please join the discussions, add issues, and get involved.
Installation
git clone https://github.com/synek/codeline.git
poetry install
Development
Codeline can monitor the current directory for file-changes, and then run any commands it finds:
poetry run codeline --watch .
Alternatively you can run Codeline on a single file, executing any commands the file and then exiting.
poetry run codeline --run path/to/python/file.py
To build a command, copy the plugins/test_plugin
as a starting point.
Commands
Currently, commands are implemented as Python plugins. The SDK for building commands is found in codeline/sdk
.
Test
The test command doesn't do anything, but shows how commands work.
Example usage:
def some_function():
# <| test run
do_something()
more_stuff()
If Codeline is monitoring the directory, then it will run the command when you save the file.
Commit
This command allows you to automatically commit a "hunk" of code.
Example usage:
# <| commit -m "Adds myfunc() to do something"
def myfunc(data):
data.do_something()
print("done")
If Codeline is monitoring the directory, then it will run the command when you save the file.
Future Work
- Add support for shell scripts
- Make it possible to pipe commands together
- Publish documentation for the SDK
Contributing
Codeline is still under heavy development. I will start accepting PRs in a couple of weeks once the development has stabilised a little. However, if you'd like to make a new command for Codeline then please get in touch with me ([email protected]) or open an issue and I'll help.