Skip to main content

Execute the commands in the configuration file according to the current working directory.

Project description

chpwd_cmd Python package

What is this?

chpwd_cmd executes the commands in the configuration file according to the current working directory. It is intended to be called from the hook function of zsh, fish and so on. With this you will no longer need to type a command every time you move the directory.

How to install

pip install chpwd-cmd

Configuration

chpwd_cmd requires configuration file at runtime. Configuration file must be located $HOME/.chpwd_cmd. Configuration File is written in Toml format.

Configuration is written in every workdir.name table. If you write more than one workdir.name, the name must be unique.

Configuration Item

name type description required
dirpath string Specifies the directory of execution. The specification of the directory can be written using the glob pattern. If the directory path is the same as the other Workdir Both commands work. True
cmd string Specifies the command to execute True

Example of configuration file

[workdir.home]
dirpath = "/Users/hoge"
cmd = "ls"

[workdir.git]
dirpath = "~/Documents/git/*/*"
cmd = "git fetch -p"

How to use

usage: chpwd_cmd [-h] [-c CWD] [-m {exec,dryrun,listdir}]

This program executes the commands in the configuration file according to the
current working directory

optional arguments:
  -h, --help            show this help message and exit
  -c CWD, --cwd CWD     current working directory
  -m {exec,dryrun,listdir}, --mode {exec,dryrun,listdir}
                        running mode (default:exec)

Execution

If you specify a directory path in exec mode, chpwd_cmd execute it. The default mode of chpwd_cmd is exec.

chpwd_cmd -m exec -c $HOME

Dryrun

It is recommended to do a dryrun before running the mode exec. You can check if a directory is targeted for execution by doing dryrun.

chpwd_cmd -m dryrun -c $HOME

List Directory

You can list the directories for execution. It is useful if you specify the directory path as a wildcard.

chpwd_cmd -m listdir

How to test

make test

License

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

chpwd_cmd-0.0.1.tar.gz (4.7 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

chpwd_cmd-0.0.1-py3.7.egg (9.4 kB view details)

Uploaded Egg

chpwd_cmd-0.0.1-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file chpwd_cmd-0.0.1.tar.gz.

File metadata

  • Download URL: chpwd_cmd-0.0.1.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.7.7

File hashes

Hashes for chpwd_cmd-0.0.1.tar.gz
Algorithm Hash digest
SHA256 7cc7b26378fb5a0f4cfbece7d617b896b00090b1ac1e9e484ca04bd968cbc5b8
MD5 19657c9d8913e90de898d5258b6c780c
BLAKE2b-256 d2ad553f71e639df89c0c8e210ac01721911b08c9e6507ac30b122aacb109afc

See more details on using hashes here.

File details

Details for the file chpwd_cmd-0.0.1-py3.7.egg.

File metadata

  • Download URL: chpwd_cmd-0.0.1-py3.7.egg
  • Upload date:
  • Size: 9.4 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.7.7

File hashes

Hashes for chpwd_cmd-0.0.1-py3.7.egg
Algorithm Hash digest
SHA256 72b548307b55b61f67d2fe69d47726f72e92c20c94f7a287d65ccd0509b18bcb
MD5 d6f06fff00a4ced06420ec35dd383857
BLAKE2b-256 5dde8c630ec2d89f862432cca81845947f36dc69d453ee65ec6bdd49bfa28735

See more details on using hashes here.

File details

Details for the file chpwd_cmd-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: chpwd_cmd-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.7.7

File hashes

Hashes for chpwd_cmd-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ba64870db52f42f6efd9028ca204f16005ea1f96d81579e42e4e6ffe4cda8edc
MD5 35fc70995160fa8b3ed444f24a31f547
BLAKE2b-256 e5d1470c7c7244f50144fa2809f729a775c63f0585442ed0b333037a728b03ce

See more details on using hashes here.

Supported by

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