AutoRunCmd
autoruncmd is a Python module that acts like a Makefile for Python projects. It allows you to define and execute a set of scripts easily using a configuration file. This tool helps in organizing and automating common project commands.
Features
- Configuration Management: Store and organize scripts in a configuration file.
- Easy Initialization: Quickly create a default configuration file.
- Add Scripts: Append new commands to your configuration.
- Search: Find specific commands within the configuration.
- Execute Scripts: Run entire sections or individual commands by referencing their headers.
Installation
To install autorunrun, use pip:
pip install AutoRunCmd
Configuration File Format
The default configuration file is .pyscripts, but you can specify a custom config file if needed.
Rules for Configuration File
-
LOC Header: The first line of the configuration file must always contain the Line Of Configuration (LOC) metadata, as follows:
# Line Of Configuration (LOC) file = <filename> [<timestamp>]- This line will be automatically added during initialization
autorun init.
- This line will be automatically added during initialization
-
Headers: Every section must have a header. Headers should:
- Begin with
[py.and end with]. - Be properly closed, e.g.,
[py.header]. - One header can contain multiple commands.
- Begin with
-
Commands: Commands under each header must follow this format:
- Each command should have a name and be assigned using
name = command. - The first
=in a line is prioritized to separate the command name from the script.
- Each command should have a name and be assigned using
-
Comments: Comments can be prefixed with
#and end with a newline. -
Ignored Lines: Any lines that do not follow these rules will be ignored during execution.
Example .pyscripts File
# Line Of Configuration (LOC) file = .pyscripts [Sun Oct 13 22:44:48 2024]
# comment
[py.header1]
cmd1_h1 = command 1 execution
cmd2_h1 = command 2 execution
[py.help]
help = python --help
python = python
Structure
- Each header (e.g.,
[py.header1]) contains one or more command lines. - Commands are defined using
name = commandpairs, where the name is the command name and the command is the script to execute.
Usage
1. Create a Config File
To initialize a configuration file, use the init command:
autorun init <file_name(optional)>
By default, the config file is created as .pyscripts, but you can provide a custom file name.
2. Add Commands
Add commands to a header within your config file using the add command:
autorun add -h <header_name> -s '<script>' -c <configfile(optional)>
-h <header_name>: Specify the header to add the command to.-s '<script>': The script to be added, in the formatname = command.-c <configfile>: Optional argument to specify the configuration file (default:.pyscripts).
3. Find Commands
Search for commands in the config file that start with a specific string:
autorun find -l <line Startswith> -h <header> -c <configfile(optional)>
-l <line Startswith>: Specify the line to find.-h <header>: Specify the header to find.-c <configfile>: Optional argument to specify the configuration file (default:.pyscripts).
This will output all lines or header in the file that match the specified prefix.
4. Run Commands
Run all the commands in a specific header or a particular command by referencing it:
- To run all commands in a header:
autorun cmd <header>
- To run a specific command within a header:
autorun cmd <header>.<command_name>
Example Workflow
-
Initialize the config:
autorun init .autoruncmd.test
-
Add a new command:
autorun add -h tests -s "test = tested sucessfully" -c .autoruncmd.test
-
Run a command from the header:
autorun run tests -c .autoruncmd.test
-
Find commands starting with a specific line:
autorun find -l test -h tests -c .autoruncmd.test
Contributing
If you have any suggestions or feedback, please open an issue or create a pull request.
License
This project is licensed under the MIT License.
Package Information
Version: 0.1.1 Title: AutoRunCmd Author: Rakesh Kanna Github: https://github.com/rakeshkanna-rk/autoruncmd PyPI: https://pypi.org/project/autoruncmd/
Metadata
Release files for AutoRunCmd 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| autoruncmd-0.1.1.tar.gz | 8.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| AutoRunCmd-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 23.5 kB
Release files / autoruncmd-0.1.1.tar.gz
| Download URL | autoruncmd-0.1.1.tar.gz |
|---|---|
| Size | 8.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2b18d2d82cf7c115278daabc570f3744742ea4dfdbf6b8b1a589d38ef166fb8e
|
|
BLAKE2b-256 checksum How to use checksums |
6e794cf87c9819832d3beddb3a07823b86ade2238b48668c8c7229f4807603b4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.2
|
Release files / AutoRunCmd-0.1.1-py3-none-any.whl
| Download URL | AutoRunCmd-0.1.1-py3-none-any.whl |
|---|---|
| Size | 15.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
327f162544e5844c8117a8aadf191e829a505970bc0c66fbb12c09168638e15f
|
|
BLAKE2b-256 checksum How to use checksums |
c27e9a382e761c90f165494eefca1a73d4b1b5464dca1278f0c28f8730a37a0d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.2
|