Skip to content

AppleGamer22/stalk

Repository files navigation

stalk

Go Reference Test CodeQL Release Update Documentation

Description

stalk is a cross-platform CLI utility for file-watching.

Why This Name?

This name is simply a stupid pun, therefore I do not condone and do not promote stalking (excluding stalking fictional individuals for the purposes of a CTF challenge).

Installation

Nix Flakes

{
  inputs = {
    # or your preferred NixOS channel
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    applegamer22.url = "github:AppleGamer22/nur";
  };
  outputs = { nixpkgs }: {
    nixosConfigurations.nixos = nixpkgs.lib.nixosSystem {
      specialArgs = {
        pkgs = import nixpkgs {
          # ...
          overlays = [
            (final: prev: {
              # ...
              ag22 = applegamer22.packages."<your_system>";
            })
          ];
        };
      };
      modules = [
        # or in a separate Nix file
        ({ pkgs, ... }: {
          programs.nix-ld.enable = true;
          environment.systemPackages = with pkgs; [
            ag22.stalk
          ];
        })
        # ...
      ];
    };
  };
}

Arch Linux Distributions

yay -S stalk-bin
paru -S stalk-bin

macOS

brew install AppleGamer22/tap/stalk

Windows (working progress)

winget install AppleGamer22.stalk

Other

  • go:
    • Does not ship with:
      • a manual page
      • pre-built shell completion scripts
go install github.com/AppleGamer22/stalk

Functionality

watch Sub-command

The arguments have to be existing files, that the user running the command can read.

-c/--command Flag

This flag specifies the command to be stopped and re-run after each file system event.

-v/--verbose Flag

This flag enables more detailed logs to be printed regarding file system events.

wait Sub-command

The arguments have to be existing files, that the user running the command can read. This command is meant to be integrated inside other scripts, which is why it only waits for a single file system event before terminating.

version Sub-command

-v/--verbose Flag

  • If this flag is provided, the following details are printed to the screen:
    1. semantic version number
    2. commit hash
    3. Go compiler version
    4. processor architecture & operating system
  • Otherwise, only the semantic version number is printed.

Dependencies

The only dependencies stalk requires are the OS-level dependencies of the github.com/fsnotify/fsnotify library.

Common Contributor Routines

Testing

Running the following command will run go test on the cmd and session sub-modules:

make test

Building From Source

Development

  • Using the following make command will save a stalk binary with the last version tag and the latest git commit hash:
make debug

Release

  • Using the following GoReleaser command with a version git tag and a clean git state:
goreleaser build --clean
  • All release artificats will stored in the dist child directory in the codebase's root directory:
    • compressed package archives with:
      • a stalk binary
      • manual page
      • shell completion scripts
    • checksums
    • change log

Copyright

stalk is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.

stalk is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.