Use arguments as paths to operate on, not module path
An alternate module path can ot be provided with the -m flag.
This interface will be more cohesive to using hareimports to
automatically format a file as it is being edited in a text editor, an
intended use case of hareimports.
A current known limitation is that the file paths provided must be
canonical (no symlinks) and absolute. It is planned to change this so
that the paths are checked to see if they resolve to the same file,
The -a option is added to tersely perform the previous behavior, of
operating on all source files in the module.
Finish list() operation; expand test_list()
Revert "Rename check target to test"
While a bit confusing because it conflicts with the command `hare test`,
it aligns with the targets used in the Makefiles for other projects.
This reverts commit 6d3d193ad7a0bc3713660c736e83645b8a4dbe2b.
Rename check target to test
Replace null statement in loop placeholder with break
Reorganize source structure into flat module
Having a cmd/hareimports path with two three files in it gives me Java
Additionally, I re-added the list() function back to main.ha, as it is
simple and will not rely on the helper functions that the operations in
I also exported the operation functions.
Move source files into module directory
Move operation functions out of main.ha
Remove trailing whitespace
Add structure to support diff and edit-in-place options
Remove explicit variable name in function pointer declaration
Use clearer field name for subunit, sub-type subunit
Use struct to represent a source file, instead of tuple
Restructure main(), add plcaeholder loops
listing imports is separated out into its own function, and an operation
function pointer is created, to make it easier to toggle between
different actions with options.
Operations on the source files is separated out of the loop where we lex
module files; comments are added to explain why this is necessary.
Various TODO comments are added to make it clear what is unfinished.
Update README.md and tagline
Provide bad getopt abort with explanatory message
Scan module instead of reading from stdin
To add imports, the program needs to be able to distinguish between
module identifiers and local enum identifiers. Enums may be declared in
other source files within the module, so knowledge of the entire module
is required to make this distinction.
Signed-off-by: Sebastian <firstname.lastname@example.org>