cqh-file-watcher

tools like vscode file-watcher but for command only


License
MIT
Install
pip install cqh-file-watcher==0.0.41

Documentation

cqh_file_watcher

something like File-Watcher for vscode

Usage

cqh_file_watcher -c ***.conf

conf example

use pattern

{"command_list":[
    {
        "pattern": "*.py",
        "command": "sudo supervisorctl restart redis"
    }
],
"directory": "/home/vagrant/code/code1"
}

no pattern

{"command_list":[

    {
        "command": "echo things changed"
    }
],
"directory": "/home/vagrant/code/code1"
}

directory for command

{"command_list":[
    {
        "pattern": "*.py",
        "command": "sudo supervisorctl restart redis"
        "directory":  "/home/vagrant"
    }
]
"directory": "/home/vagrant/code/code1"
}

add ignore pattern for one

{"command_list":[
    {
        "pattern": "*.py",
        "ignore_pattern": ["_build/.*"],
        "command": "sudo supervisorctl restart redis"
        "directory":  "/home/vagrant"
    }
]
"directory": "/home/vagrant/code/code1"
}

add ignore pattern for multi

{"command_list":[
    {
        "pattern": "*.py",
        "ignore_pattern": ["_build/.*" , "_download/.*", "^css/.*", "^_static/.*"],
        "command": "sudo supervisorctl restart redis"
        "directory":  "/home/vagrant"
    }
]
"directory": "/home/vagrant/code/code1"
}

use DIRECTORY env

{"command_list":[
    {
        "pattern": "*.py",
        "ignore_pattern": ["_build/.*" , "_download/.*", "^css/.*", "^_static/.*"],
        "command": "sudo supervisorctl restart redis"
        "directory":  "/home/vagrant"
    }
]
"directory": "${DIRECTORY}"
}

some problems

sre_constants.error: nothing to repeat at position 0

config

{"command_list":[
    {
        "pattern": "*\\.py",
        "ignore_pattern": ["_build/.*" , "_download/.*", "^css/.*", "^_static/.*"],
        "command": "${DIRECTORY}/venv/bin/invoke gpush"
    }
],
"directory": "${DIRECTORY}"
}

replace pattern: "*\\.py" with patter: ".*\\.py"