Coder Social home page Coder Social logo

godemon's Introduction

Golang gopher mascot with little horns

godemon

go test License: Unlicense

godemon is a tool that runs a command, monitors for changes to files, and restarts the command automatically whenever files change.

It is great for:

  • Restarting a development server whenever you change source code
  • Running tests whenever you change source code
  • Mirroring a directory to another location, using a tool like rsync
  • Lots of other things!

It is inspired by nodemon which is a similar tool written in JavaScript.

Goals

  • Generic: Does not give preference to any language or framework (even Go). Can run arbitrary comands when changing arbitrary files.
  • Configurable: There is no "one size fits all" approach to file watchers, so godemon gives you fine-grained control over the paths that are included or ignored. For more advanced users, it also lets you control which signals are used to restart your process, since different processes respond differently to different signals.
  • Strong defaults: godemon ships with a default ignore list and also treats .gitignore files as additional ignore patterns. These defaults can be turned off via config options.

Status

godemon has been tested on Mac and Linux. It has not yet been tested on Windows.

The command line interface and config file format are not yet stable.

Installation

The easiest way to install godemon is with the go CLI:

go install github.com/bduffany/godemon/cmd/godemon@latest

Basic usage

The godemon command can be used as follows:

godemon [options ...] <command> [args ...]

By default, the given command is executed whenever any file in the current directory changes.

Examples

To watch the current directory (recursively) and run a command on any change:

godemon command

To watch multiple directories, use --watch or -w. When using this flag, the current directory needs to be passed explicitly, otherwise it's assumed that you only want to watch /some/other/dir (in this example).

godemon --watch . --watch /some/other/dir command

To only restart on changes to certain paths or patterns, use --only or -o:

godemon --only '*.ts' --only '*.tsx' command

To ignore changes to certain paths or patterns, use --ignore or -i:

godemon --ignore '**/build/**' --ignore '**/dist/**' command

Default ignored patterns

The default ignored patterns are listed in default_ignore.go.

To disable the default ignore list, pass --no-default-ignore.

By default, godemon also ignores patterns that are listed in .gitignore files for any watched paths which are contained in a Git repository. To disable this behavior, pass --no-gitignore.

godemon's People

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.