All Projects → wtetsu → Gaze

wtetsu / Gaze

Licence: mit
👁️Executes commands for you

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to Gaze

Cryptoanalysis
CogniCrypt_SAST: CrySL-to-Static Analysis Compiler
Stars: ✭ 36 (-41.94%)
Mutual labels:  command-line-tool
Catage
Node package and CLI tool to convert code into an image with syntax highlighting
Stars: ✭ 44 (-29.03%)
Mutual labels:  command-line-tool
Foxify Cli
💻 Firefox Command-Line Theme Manager 🦊 Inspired by spicetify-cli 🔥
Stars: ✭ 55 (-11.29%)
Mutual labels:  command-line-tool
Sqlite Global Tool
SQLite .NET Core CLI tool that allows the user to manually enter and execute SQL statements with or without showing query result.
Stars: ✭ 37 (-40.32%)
Mutual labels:  command-line-tool
Coreutils
Cross-platform Rust rewrite of the GNU coreutils
Stars: ✭ 9,603 (+15388.71%)
Mutual labels:  command-line-tool
To Fish
Bookmarks for Fish Shell
Stars: ✭ 44 (-29.03%)
Mutual labels:  command-line-tool
Moviescore
A cli tool to get movie ratings and reviews directly to your terminal!
Stars: ✭ 35 (-43.55%)
Mutual labels:  command-line-tool
Q
q - Run SQL directly on CSV or TSV files
Stars: ✭ 8,809 (+14108.06%)
Mutual labels:  command-line-tool
Ed
A modern UNIX ed (line editor) clone written in Go
Stars: ✭ 44 (-29.03%)
Mutual labels:  command-line-tool
Reorder
Reorder Swift functions
Stars: ✭ 51 (-17.74%)
Mutual labels:  command-line-tool
Samay
Command line Time tracking and reporting. Built using Go(programming language) and protocol buffers.
Stars: ✭ 37 (-40.32%)
Mutual labels:  command-line-tool
Kube Aliases
Kubernetes Aliases and Bash Functions
Stars: ✭ 40 (-35.48%)
Mutual labels:  command-line-tool
Note
Quick and easy Command-line tool for taking notes.
Stars: ✭ 49 (-20.97%)
Mutual labels:  command-line-tool
Football Cli
⚽ Command line interface for Hackers who love football
Stars: ✭ 984 (+1487.1%)
Mutual labels:  command-line-tool
Rff Cli Example
An example of how to use 🏁 React Final Form in a CLI application with Ink
Stars: ✭ 55 (-11.29%)
Mutual labels:  command-line-tool
Wsay
Windows "say"
Stars: ✭ 36 (-41.94%)
Mutual labels:  command-line-tool
Upt
Universal Package-management Tool for Windows, macOS and Linux.
Stars: ✭ 45 (-27.42%)
Mutual labels:  command-line-tool
Spell Checker For Swift
This command line tool can check spelling and show proposed correction.
Stars: ✭ 61 (-1.61%)
Mutual labels:  command-line-tool
Xcperfect
Make your xccov outputs prettier ✨
Stars: ✭ 56 (-9.68%)
Mutual labels:  command-line-tool
Gitauthors
✍️ Get a quick summary of a repo's authors.
Stars: ✭ 50 (-19.35%)
Mutual labels:  command-line-tool

Gaze is gazing at you

GAZE

Test Go Report Card Codacy Badge codecov

What is Gaze?

👁️Gaze runs a command, right after you save a file.

It greatly helps you focus on writing code! gaze02


Gaze's usage is quite simple.

gaze .

And invoke your favorite editor on another terminal and edit it!

vi a.py

Use cases:

👁️Gaze runs a script, right after you save it (e.g. Python, Ruby),

You can also use Gaze for these purposes:

  • 👁️Gaze runs tests, right after you save a Ruby script
  • 👁️Gaze runs linter, right after you save a JavaScript file
  • 👁️Gaze runs "docker build .", right after you save Dockerfile
  • 👁️And so forth...

Software development often forces us to execute the same command again and again, by hand!

Let's say, you started writing a really really simple Python script. You created a.py, wrote 5 lines of code and run "python a.py". Since the result was not perfect, you edited a.py again, and run "python a.py" again.

Again and again...

Before you realized, you've saved the same file and type the same command thousands of times.

That's totally waste of time and energy!


👁️Gaze runs a command on behalf of you, right after you edit files.

Why Gaze? (Features)

Gaze is designed as a CLI tool that accelerates your coding.

  • Easy to use, out-of-the-box
  • Super quick reaction
  • Language-agnostic, editor-agnostic
  • Flexible configuration
  • Useful advanced options
    • -r: restart (useful for server applications)
    • -t 2000: timeout (useful if you sometimes write infinite loops)
  • Multiplatform (macOS, Windows, Linux)
  • Can deal with "create-and-rename" type of editor's save behavior
    • Super major editors like Vim and Visual Studio are such editors
  • Appropriate parallel handling

I developed Gaze in order to deal with my every day's coding.

Even though there are already many "update-and-run" type of tools, I would say Gaze is the best tool for quick coding because all the technical design decisions have been made for that purpose.

Installation

Brew (Only for OSX)

brew tap wtetsu/gaze
brew install gaze

Download binary

https://github.com/wtetsu/gaze/releases

How to use Gaze

The top priority of the Gaze's design is "easy to invoke".

By this command, Gaze starts watching the files in the current directory.

gaze .

On another terminal, run vi a.py and edit it. Gaze executes a.py in response to your file modifications!

Other examples

Gaze at one file. You can just simply specify file names.

gaze a.py

Gaze doesn't have special options to specify files. You can use wildcards (*, **, ?) that shell users are familiar with. You don't have to remember Gaze-specific command-line options!

gaze "*.py"

Gaze at subdirectories. Runs a modified file.

gaze "src/**/*.rb"

Gaze at subdirectories. Runs a command to a modified file.

gaze "src/**/*.js" -c "eslint {{file}}"

Kill an ongoing process, every time before it runs the next. This is useful when you are writing a server.

gaze -r server.py

Kill an ongoing process, after 1000(ms). This is useful if you love to write infinite loops.

gaze -t 1000 complicated.py

In order to run multiple commands for one update, just simply write multiple lines (use quotations for general shells). If an exit code was not 0, Gaze doesn't invoke the next command.

gaze "*.cpp" -c "gcc {{file}} -o a.out
ls -l a.out
./a.out"

Here is output when a.cpp was updated.

[gcc a.cpp -o a.out](1/3)

[ls -l a.out](2/3)
-rwxr-xr-x 1 user group 42155 Mar  3 00:31 a.out

[./a.out](3/3)
hello, world!

When compilation failed:

[gcc a.cpp -o a.out](1/3)
a.cpp: In function 'int main()':
a.cpp:5:28: error: expected ';' before '}' token
   printf("hello, world!\n")
                            ^
                            ;
 }
 ~
exit status 1

Configuration

Gaze is Language-agnostic.

But it has useful default configurations for several major languages (e.g. Go, Python, Ruby, JavaScript, D, Groovy, PHP, Java, Kotlin, Rust, C++, TypeScript, and Docker).

Thanks to the default configurations, the command below is valid. You don't have to specify python command.

gaze a.py

By default, the above is the same as:

gaze a.py -c 'python "{{file}}"'

Gaze searches a configuration file according to it's priority rule.

  1. A file specified by -f option
  2. ./gaze.yml
  3. ~/.gaze.yml
  4. (Default)

You can display the default YAML configuration by running gaze -y.

commands:
  - ext: .go
    cmd: go run "{{file}}"
  - ext: .py
    cmd: python "{{file}}"
  - ext: .rb
    cmd: ruby "{{file}}"
  - ext: .js
    cmd: node "{{file}}"
  - ext: .d
    cmd: dmd -run "{{file}}"
  - ext: .groovy
    cmd: groovy "{{file}}"
  - ext: .php
    cmd: php "{{file}}"
  - ext: .java
    cmd: java "{{file}}"
  - ext: .kts
    cmd: kotlinc -script "{{file}}"
  - ext: .rs
    cmd: |
      rustc "{{file}}" -o"{{base0}}.out"
      ./"{{base0}}.out"
  - ext: .cpp
    cmd: |
      gcc "{{file}}" -o"{{base0}}.out"
      ./"{{base0}}.out"
  - ext: .ts
    cmd: |
      tsc "{{file}}" --out "{{base0}}.out"
      node ./"{{base0}}.out"
  - re: ^Dockerfile$
    cmd: docker build -f "{{file}}" .

Note:

  • To specify both ext and re for one cmd is prohibited
  • cmd can have multiple commands. In YAML, a vertical line(|) is used to express multiple lines

You're able to have your own configuration very easily.

gaze -y > ~/.gaze.yml
vi ~/.gaze.yml

Options:

Usage: gaze [options...] file(s)

Options:
  -c  Command(s).
  -r  Restart mode. Send SIGTERM to an ongoing process before invoking next.
  -t  Timeout(ms). Send SIGTERM to an ongoing process after this time.
  -f  Specify a YAML configuration file.
  -v  Verbose mode.
  -q  Quiet mode.
  -y  Display the default YAML configuration.
  -h  Display help.
  --color    Color mode (0:plain, 1:colorful).
  --version  Display version information.

Examples:
  gaze .
  gaze main.go
  gaze a.rb b.rb
  gaze -c make "**/*.c"
  gaze -c "eslint {{file}}" "src/**/*.js"
  gaze -r server.py
  gaze -t 1000 complicated.py

Command format

You can write Mustache templates for commands.

gaze -c "echo {{file}} {{ext}} {{abs}}" .
Parameter Example
{{file}} src/mod1/main.py
{{ext}} .py
{{base}} main.py
{{base0}} main
{{dir}} src/mod1
{{abs}} /my/proj/src/mod1/main.py

Third-party data

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].