Skip to content
This repository was archived by the owner on Mar 4, 2022. It is now read-only.
This repository was archived by the owner on Mar 4, 2022. It is now read-only.

Command-line file/directory specification #16

Description

@bufdev

Right now, most commands take something along the lines of dirOrProtoFiles... as their first arguments. These commands also have a flag --dir-mode. The possibilities:

  • You can specify multiple files. If this is done, these files will be explicitly used for protoc calls etc.
  • You can specify exactly one directory. If this is done, Prototool goes up until it finds a prototool.yaml file (or uses the current directory if none is found), and then walks starting at this location for all .proto files, and these are used, except for files in the excludes lists in prototool.yaml files.
  • You can specify exactly one file, along with --dir-mode. This has the effect as if you specified the directory of this file (using the logic above), but errors are only printed for that file. This is useful for e.g. Vim integration.

The idea with "directory builds" is that you often need more than just one file to do a protoc call, for example if you have types in other files in the same package that are not referenced by their fully-qualified name, and/or if you need to know what directories to specify with -I to protoc (by default, the directory of the prototool.yaml file is used).

In general practice, directory builds are what you always want to do. File builds were just added for convenience.

There's a proposal to do the following instead:

  • Only one argument is specified. This has the side effect of making the number of arguments to many commands consistent.
  • If a directory is speficied, do directory mode, as usual.
  • If a file is specified, do the equivalent of --dir-mode above.

There are some side effects, for example you need to special-case the format command probably, but we probably want to do this. It's not as trivial as I first realized, and wanted to open this up for discussion before I do it.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions