Skip to main content

cmdfile runs annoying commands automatically.

Project description

cmdfile

cmdfile runs annoying commands automatically.

Docs

Installation

Run python -m pip install cmdfile in your terminal.

Usage

You can use cmdfile as a command, or as a module.

Example for using as a command:

> python -m cmdfile build
Hello

You can specify cmdfile filename with the following: python -m cmdfile tablename filename

(By default, if you simply run python -m cmdfile, it will run the main table of the cmdfile file)

This will run the hello table of the cmdfile, note that the cmdfile must be in the directory you're running the script from, example cmdfile:

(hello)
echo Hello

python -m cmdfile check temp is the equivalent of this:

import cmdfile

cmdfile.run("check", filename="temp")

Variables

You can declare variables in the cmdfile using:

# You can declare variables outside of tables
# some_variable = "I'm not in any table!"

(table)
variable = "some text"

echo {{variable}}

some text

You can also declare variables through code like this:

import cmdfile

cmdfile.add_var("variable", "some text")
cmdfile.run("table")

And then this will also output some text:

(table)
echo {{variable}}

Changing the shell

You can change what shell to use by changing the shell variable:

shell = "powershell.exe -c"

[main]
echo 'Hello' # Executes "powershell.exe -c echo 'Hello'"

Requirements

Requirements are tables that run before the main table, example:

[main] a_requirement another_requirement
# This will call a_requirement, another_requirement and main, respectively


[a_requirement]
# ...

[another_requirement]
# ...

1.2.1 Bugfix

  • Fixed filename by default being "cmd" and not "cmdfile"

Changelog for 1.2.0

  • Added "requirements", this calls other tables before running the current table, example:
[main] a_requirement another_requirement
# This will call a_requirement, another_requirement and main, respectively


[a_requirement]
# ...

[another_requirement]
# ...
  • You can now select the shell to use to run commands like this:
shell = "powershell.exe -c"

[main]
echo 'Hello' # Executes "powershell.exe -c echo 'Hello'"
  • Changed variable usage from {_varname_} to {{varname}}

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

cmdfile-1.2.1.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

cmdfile-1.2.1-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file cmdfile-1.2.1.tar.gz.

File metadata

  • Download URL: cmdfile-1.2.1.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.1

File hashes

Hashes for cmdfile-1.2.1.tar.gz
Algorithm Hash digest
SHA256 4e6eb5d4529a6f3c7214522d18d18c2d6ce978ae60023b9bdcd6f0fae6f26781
MD5 980a57ceac1444564aa2680425f0c81c
BLAKE2b-256 18ea551da9f6cb1e85aa7a4772c7543547dc1ecc1f77a24d3e5ab6362d9d2100

See more details on using hashes here.

File details

Details for the file cmdfile-1.2.1-py3-none-any.whl.

File metadata

  • Download URL: cmdfile-1.2.1-py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.1

File hashes

Hashes for cmdfile-1.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6d8cc0a2ec71c825e157d5a7dade716ee8f5bdc5ac155b7997d0c6f734f2843e
MD5 fb36cdfeb384756a52642acdc5f05316
BLAKE2b-256 da88dfb2bf292da353ad345e0cc0d12c5ea08d1225f845b2c45aa3178e343eaf

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