You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In v0.44, we plan to introduce a --chdir option to move the working directory, similar to Terraform. See also #1612.
In Terraform, the --chdir has a special meaning to other flags. Below is a quote from the PR where --chdir was introduced:
The new option is only accepted at the start of the command line (before the subcommand) as a way to reflect that it is a global command (not specific to a particular subcommand) and that it takes effect before executing the subcommand. This also means it'll be forced to appear before any other command-specific arguments that take file paths, which hopefully communicates that those other arguments are interpreted relative to the overridden path.
If we adopt a concept similar to this in TFLint, we cannot force the user to assume that the path will be relative to the changed directory, since TFLint has no concept of subcommands.
Proposal
Introduce a subcommand as below and allow --chdir only before the subcommand:
tflint --chdir=dir init
tflint --chdir=dir inspect
tflint --chdir=dir langserver
tflint --chdir=dir version
For my personal taste, it feels a bit redundant to always require a subcommand for inspection. To improve the user's first experience, I would like the inspection to work with just running tflint without subcommands.
To implement the behavior where -chdir is handled differently than sub-command flags, Terraform manually processes (and strips) it before passing off the args to be parsed as flags:
Introduction
Currently, TFLint has 4 modes of operation.
tflint --init
tflint
tflint --langserver
tflint --version
In v0.44, we plan to introduce a
--chdir
option to move the working directory, similar to Terraform. See also #1612.In Terraform, the
--chdir
has a special meaning to other flags. Below is a quote from the PR where--chdir
was introduced:hashicorp/terraform#26087
If we adopt a concept similar to this in TFLint, we cannot force the user to assume that the path will be relative to the changed directory, since TFLint has no concept of subcommands.
Proposal
Introduce a subcommand as below and allow
--chdir
only before the subcommand:tflint --chdir=dir init
tflint --chdir=dir inspect
tflint --chdir=dir langserver
tflint --chdir=dir version
For my personal taste, it feels a bit redundant to always require a subcommand for inspection. To improve the user's first experience, I would like the inspection to work with just running
tflint
without subcommands.In terms of compatibility with Terraform, https://github.com/mitchellh/cli would be a good option. Another popular one would be https://github.com/spf13/cobra. What to use should be decided after more detailed research.
References
The text was updated successfully, but these errors were encountered: