Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add changed environment variable #39

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

mvochoa
Copy link

@mvochoa mvochoa commented Nov 13, 2019

An environment variable was added with the file path that was modified, so that the user can use it in the commands.

$ CompileDaemon --build="go build \$FILE"

In addition, the help message was modified:

$ CompileDaemon --help
Copyright (c) 2013, Marian Tietz

Examples

In its simplest form, the defaults will do. With the current working directory set
to the source directory you can simply…

    $ CompileDaemon

… and it will recompile your code whenever you save a source file.

If you want it to also run your program each time it builds you might add…

    $ CompileDaemon -command="./MyProgram -my-options"

… and it will also keep a copy of your program running. Killing the old one and
starting a new one each time you build. For advanced usage you can also supply
the changed file to the command by doing…

	$ CompileDaemon -command="./MyProgram -my-options %[1]s"

…but note that this will not be set on the first start.

You may find that you need to exclude some directories and files from
monitoring, such as a .git repository or emacs temporary files…

    $ CompileDaemon -exclude-dir=.git -exclude=".#*"

If you want to monitor files other than .go and .c files you might…

    $ CompileDaemon -include=Makefile -include="*.less" -include="*.tmpl"

If you only need to work with the file that changes, the $FILE variable has the modified file path

    $ CompileDaemon --build="go build \$FILE"

Usage of CompileDaemon:

  -build string
    	Command to rebuild after changes (default "go build")
  -build-dir string
    	Directory to run build command in.  Defaults to directory
  -color
    	Colorize output for CompileDaemon status messages
  -command string
    	Command to run and restart after build
  -command-stop
    	Stop command before building
  -directory string
    	Directory to watch for changes (default ".")
  -exclude value
    	 Don't watch files matching this name
  -exclude-dir value
    	 Don't watch directories matching this name
  -graceful-kill
    	Gracefully attempt to kill the child process by sending a SIGTERM first
  -graceful-timeout uint
    	Duration (in seconds) to wait for graceful kill to complete (default 3)
  -include value
    	 Watch files matching this name
  -log-prefix
    	Print log timestamps and subprocess stderr/stdout output (default true)
  -pattern string
    	Pattern of watched files (default "(.+\\.go|.+\\.c)$")
  -recursive
    	Watch all dirs. recursively (default true)
  -run-dir string
    	Directory to run command in.  Defaults to directory
  -verbose
    	Be verbose about which directories are watched.

@githubnemo
Copy link
Owner

Hi, thanks for your PR and sorry for the wait.

This seems to be a sensible addition but it is quite hard to review the relevant portions of the change among all the other changes. I will take a look, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants