Giter VIP home page Giter VIP logo

closest's Introduction

closest

The command that searches the current directory or parent directories for a specific file and returns the closest path.

Install

There are two ways to install closest.

  • Download the binary from GitHub Releases
  • Install via aqua

Usage

Usage: closest [options] [pattern]
Options:
  -a    Search all files[default: false]

To find a closest file the current directory, run the following:

closest .tflint.hcl

To find all files from the current directory to root directory, run the following:

closest -a .envrc

Example 1: Find a .tflint.hcl file and run tflint

tflint only references .tflint.hcl in the current or home directory. This makes it easy to read per-project settings in the repository root or in the terraform directory in monorepo.

The directory structure is as follows, where staging is the current directory.

/
└── home
    └── app
        └── terraform
            ├── .tflint.hcl
            └── example-service
                ├── production
                └── staging # <- current directory

To run tflint in combination with closest, run the following:

tflint --config $(closest .tflint.hcl)

Example 2: Find all .envrc files up to the root directory

Sometimes when using direnv, you want to find where .envrc is defined from the root directory to the current directory. In that case, you can use the -a option to display all .envrc files up to the root directory, which is useful for troubleshooting.

The directory structure is as follows, where production is the current directory.

/
└── home
    └── app
        ├── .envrc
        └── terraform
            ├── .envrc
            └── example-service
                ├── .envrc
                ├── production  # <- current directory
                |   └── .envrc
                └── staging

To find all .envrc from production to the root directory, run the following:

closest -a .envrc

Please take care that the filename must be prefix with -a. For example, closest .envrc -a doesn't work.

The output:

/home/app/terraform/example-service/production/.envrc
/home/app/terraform/example-service/.envrc
/home/app/terraform/.envrc
/home/app/.envrc

closest's People

Contributors

corrupt952 avatar renovate[bot] avatar

Stargazers

 avatar

Watchers

 avatar  avatar

closest's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

This repository currently has no open or pending branches.

Detected dependencies

github-actions
.github/workflows/release.yaml
  • actions/checkout v4@0ad4b8fadaa221de15dcec353f45205ec38ea70b
  • actions/setup-go v5
  • goreleaser/goreleaser-action v5
gomod
go.mod
  • go 1.19
regex
aqua.yaml
  • golang/go go1.22.2
aqua.yaml
aqua.yaml
  • aquaproj/aqua-registry v4.171.0
aqua.yaml
  • golang/go 1.22.2

  • Check this box to trigger a request for Renovate to run again on this repository

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.