ls-having

Install latest/stable of ls-having

Ubuntu 16.04 or later?

Make sure snap support is enabled in your Desktop store.


Install using the command line

sudo snap install ls-having

Don't have snapd? Get set up for snaps.

Channel Version Published

A command-line tool for finding directories based on specified flag files and other conditions

ls-having is a powerful open-source tool that makes it easy to find directories. With a simple and intuitive command-line interface, "ls-having" allows you to quickly search for directories based on specified flag files and other conditions, saving you time and effort. Whether you're a developer who works with mono repos, or you just need an easy way to find your directories, "ls-having" is the perfect tool for you.

  • Flexible search options: "ls-having" allows you to specify various options and conditions for searching for directories, such as flag files, the check file, regular expressions for matching the check file, excludes, and maximum depth.
  • Configurable error handling: "ls-having" provides an option for configuring how it handles errors such as non-existing directory or no access permission, allowing users to customize and integrate the tool for different situations.
  • Cross-platform support: "ls-having" is available for Linux, MacOS, and Windows.
  • Small and quick: "ls-having" has just one native executable file, there is no dependency on anything else, and the tool is just about 2MB in size. It starts and runs very quickly.

Quick start

Try this:

ls-having -f package.json

This will search for directories containing a "package.json" file in the current directory and print the names of those directories to the console. You can then use the output of "ls-having" as arguments for other commands, such as "xargs", to perform actions on those directories.

For more information on how to use "ls-having" and the available options and arguments, visit https://github.com/handy-common-utils/ls-having or run the ls-having --help command.

Usage

 Usage: ls-having -f name-or-glob [options] [root-dir]
 Options:
   -c, --check-file name          name of the additional file to check
   -i, --check-inverse            regard regular expression not matching as positive
   -e, --check-regexp expression  regular expression for testing the content of the check file (default ".*")
   -d, --depth int                how deep to look into subdirectories, 0 means only look at root directory, -1 means no limit (default 5)
   -r, --error string             how to handle errors such like non-existing directory, no access permission, etc. (ignore|panic|print) (default "ignore")
   -x, --exclude glob             glob of the directories to exclude, this option can appear multiple times
   -f, --flag-file glob           name or glob of the flag file, this option can appear multiple times
   -h, --help                     show help information
   -a, --match-all-flag-files      require all (instead of any) of the flag file names/globs to be matched
   -n, --no-default-excludes      don't apply default excludes
   -0, --print0                   separate paths in the output with null characters (instead of newline characters)
   -s, --subdirectories-only      don't return root directory even if it meets conditions
 References:
   Glob syntax: https://github.com/gobwas/glob#example
   Regexp syntax: https://pkg.go.dev/regexp/syntax
   Home page: https://github.com/handy-common-utils/ls-having 

Examples

Find all directories in ./ having package.json file, and run npm audit fix in them one by one:

ls-having -f package.json | xargs -I {} bash -c 'cd "{}"; npm audit fix'

Find all directories in ./ having package.json file and the package.json file does not contain "volta"::

ls-having -c package.json -i -e '"volta":'

Find all directories in ./ having cdk.json file and the package.json file in the directory has mocha specified as a dependency, then for each of those directories reinstall latest version of mocha as dev-dependency:

ls-having -f cdk.json -c package.json -e '"dependencies":\s*{[^{}]*"mocha":' | xargs -I {} bash -c 'cd {}; npm i -D mocha@latest'

Find all directories in ~/myrepo1 having build.gradle file and a sibling directory australia:

ls-having -f build.gradle -c ../australia ~/myrepo1

Details for ls-having

License
  • Apache-2.0

Last updated
  • 27 May 2023 - latest/stable
  • 27 May 2023 - latest/edge

Websites

Share this snap

Generate an embeddable card to be shared on external websites.


Install ls-having on your Linux distribution

Choose your Linux distribution to get detailed installation instructions. If yours is not shown, get more details on the installing snapd documentation.


Where people are using ls-having

Users by distribution (log)

Ubuntu 22.04

Is there a problem with ls-having? Report this app