Skip to main content

Runs multi scripts with a simple line of prompt with a config dot file in your environment

Project description

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

  1. 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.
  2. 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.
  3. 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.
  4. Comments: Comments can be prefixed with # and end with a newline.

  5. 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 = command pairs, 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 format name = 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

  1. Initialize the config:

    autorun init .autoruncmd.test
    
  2. Add a new command:

    autorun add -h tests -s "test = tested sucessfully" -c .autoruncmd.test 
    
  3. Run a command from the header:

    autorun run tests -c .autoruncmd.test
    
  4. 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/

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

autoruncmd-0.1.1.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

AutoRunCmd-0.1.1-py3-none-any.whl (15.3 kB view details)

Uploaded Python 3

File details

Details for the file autoruncmd-0.1.1.tar.gz.

File metadata

  • Download URL: autoruncmd-0.1.1.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.2

File hashes

Hashes for autoruncmd-0.1.1.tar.gz
Algorithm Hash digest
SHA256 2b18d2d82cf7c115278daabc570f3744742ea4dfdbf6b8b1a589d38ef166fb8e
MD5 5508509a309ea6a95e748898990d7316
BLAKE2b-256 6e794cf87c9819832d3beddb3a07823b86ade2238b48668c8c7229f4807603b4

See more details on using hashes here.

File details

Details for the file AutoRunCmd-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: AutoRunCmd-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 15.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.2

File hashes

Hashes for AutoRunCmd-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 327f162544e5844c8117a8aadf191e829a505970bc0c66fbb12c09168638e15f
MD5 05c6a0dc4c522c133b4e0b98ab99e29f
BLAKE2b-256 c27e9a382e761c90f165494eefca1a73d4b1b5464dca1278f0c28f8730a37a0d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page