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.
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
You are about to open
Do you wish to proceed?
Thank you for your report. Information you provided will help us investigate further.
There was an error while sending your report. Please try again later.
Snaps are applications packaged with all their dependencies to run on all popular Linux distributions from a single build. They update automatically and roll back gracefully.
Snaps are discoverable and installable from the Snap Store, an app store with an audience of millions.
Snap is available for Red Hat Enterprise Linux (RHEL) 8 and RHEL 7, from the 7.6 release onward.
The packages for RHEL 7, RHEL 8, and RHEL 9 are in each distribution’s respective Extra Packages for Enterprise Linux (EPEL) repository. The instructions for adding this repository diverge slightly between RHEL 7, RHEL 8 and RHEL 9, which is why they’re listed separately below.
The EPEL repository can be added to RHEL 9 with the following command:
sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
sudo dnf upgrade
The EPEL repository can be added to RHEL 8 with the following command:
sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
sudo dnf upgrade
The EPEL repository can be added to RHEL 7 with the following command:
sudo rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
Adding the optional and extras repositories is also recommended:
sudo subscription-manager repos --enable "rhel-*-optional-rpms" --enable "rhel-*-extras-rpms"
sudo yum update
Snap can now be installed as follows:
sudo yum install snapd
Once installed, the systemd unit that manages the main snap communication socket needs to be enabled:
sudo systemctl enable --now snapd.socket
To enable classic snap support, enter the following to create a symbolic link between /var/lib/snapd/snap
and /snap
:
sudo ln -s /var/lib/snapd/snap /snap
Either log out and back in again or restart your system to ensure snap’s paths are updated correctly.
To install ls-having, simply use the following command:
sudo snap install ls-having
Browse and find snaps from the convenience of your desktop using the snap store snap.
Interested to find out more about snaps? Want to publish your own application? Visit snapcraft.io now.