Commit Graph

288 Commits

Author SHA1 Message Date
Andika Demas Riyandi
35aecfab68
update mtimes on current manifest (#64)
* update mtimes on current manifest

* Add command resolved path, mtime

* Update src/lib.rs

Co-authored-by: Jonas Chevalier <zimbatm@zimbatm.com>
2021-02-22 12:07:26 +01:00
Basile Henry
341fc9ea76
Merge pull request #63 from numtide/basile/bench
Setup benchmark
2021-02-20 12:35:40 +01:00
Basile Henry
190d447c0f Setup benchmark
`criterion` is a powerful benchmark crate that works on rust stable.

This commit sets up a basic benchmark to get things started and
understand the performance of the program better.
2021-02-20 11:08:24 +01:00
Andika Demas Riyandi
3ad67a3851
adding working directory option on prjfmt.toml for each formatter (#59)
* adding working directory option on prjfmt.toml for each formatter

* rename workdir into work_dir

* switch from xshell into process::Command

* fix unordered command_context by changing to BTreeMap
2021-02-19 17:02:33 +01:00
Jonas Chevalier
f53c70d5ac
Merge pull request #62 from numtide/include-exclude
yet another refactor
2021-02-18 14:19:48 +00:00
zimbatm
6a4b7997e3
formatters -> eval_cache
Group all the evaluation cache functions together
2021-02-18 14:13:03 +01:00
zimbatm
4e6698e9e8
fix clippy warnings 2021-02-18 13:55:19 +01:00
zimbatm
a053fd2a9b
restore the --init advice 2021-02-18 13:54:04 +01:00
zimbatm
bc53597e07
engine: load the config only once per run 2021-02-18 13:46:52 +01:00
zimbatm
477de5c29d
introduce config module
Group all of the project configuration into a single location.
2021-02-18 13:33:15 +01:00
zimbatm
b2cb879ef6
singluarize formatters 2021-02-18 12:47:51 +01:00
zimbatm
941fadc964
move the examples/treefmt.toml to the top-level 2021-02-18 12:41:47 +01:00
zimbatm
e2022c372f
cli: only lookup cwd if needed 2021-02-18 12:30:10 +01:00
zimbatm
76d511ea87
cli: cleanup usage 2021-02-18 12:03:26 +01:00
zimbatm
dc9886217a
FmtConfig: use more default
The command argument is required, the other ones can be filled with an
empty value if unspecified. It makes the code simpler.
2021-02-18 11:53:56 +01:00
zimbatm
7a45f41e2a
include/exclude 2021-02-18 11:47:13 +01:00
zimbatm
ff41d7d50d
README: add prettier to the list of related projects 2021-02-18 11:46:58 +01:00
zimbatm
58d3f9e276
cargo fmt 2021-02-18 11:39:50 +01:00
Jonas Chevalier
6269d43fe2
README: cleanup to actual usage (#61)
Remove exploratory stuff and only keep what is working right now.
2021-02-18 11:35:03 +01:00
Jonas Chevalier
f39d568016
README: add Matrix channel (#58)
Make it easier for people to come and talk to us.
2021-02-17 19:17:02 +01:00
Jonas Chevalier
4b2db6207a
Merge pull request #57 from numtide/misc-cleanup
misc cleanup
2021-02-17 16:37:07 +00:00
zimbatm
61f6d5a34c
update the tagline
and make it rime
2021-02-17 15:47:24 +01:00
zimbatm
26234d2919
rust: resolve all the clippy warnings 2021-02-17 15:47:23 +01:00
zimbatm
63f5b44dc4
flake: cleanup and update
Simplify the main flake.nix and update dependencies.
2021-02-15 21:37:28 +01:00
zimbatm
59f08aaf3b
ci: introduce ./ci.sh
Make it easy to test CI as a developer. If ./ci.sh succeeds, it should
work on CI.
2021-02-15 21:36:21 +01:00
zimbatm
4e6418e5c5
cargo update
keep things fresh
2021-02-15 21:35:25 +01:00
Jonas Chevalier
08d9fcf21f
rename to treefmt (#56) 2021-02-15 20:22:03 +00:00
Andika Demas Riyandi
c2641b429a
implement lookup function to find prjfmt.toml (#52) 2021-02-15 14:20:05 +01:00
Andika Demas Riyandi
b8c28e6b1d
Merge pull request #51 from numtide/devshell-update
devshell: update to latest version
2021-02-14 04:40:01 +07:00
zimbatm
2ef8d63a32
devshell: update to latest version 2021-02-13 19:58:58 +01:00
Andika Demas Riyandi
d58362ca3a
Detect mtimes file after formatting (#50)
* Detect mtimes file after formatting

* fix test

* remove all .as_path() function
2021-02-11 15:54:10 +01:00
Andika Demas Riyandi
c8e525f78c
Engine refactor (#48)
* refactor: move src/formatters/tool.rs to src/engine.rs

Start to put the utilities in the right place. More follow-up
refactoring is required.

* clean run_cli

* engine annotations

* docs: started a list of formatters

* refactor types, function, and argument naming

Co-authored-by: zimbatm <zimbatm@zimbatm.com>
2021-02-10 14:37:34 +01:00
Jonas Chevalier
22ae114512
Update README.md
link to svg
2021-02-10 09:53:14 +01:00
Basile Henry
3334d02b99
Add logo (#47) 2021-02-10 09:51:58 +01:00
Jonas Chevalier
df57ed8789
nix: use naerks, remove complexity (#45)
Introduce naersk so we don't have to update the cargoSha256 all the
time.

Use nixpkgs rust instead of rust-overlay to make the integration with
naersk easier.

Remove the overlay as it wasn't very useful. Since we depend on
third-party dependencies, the overlay cannot be used in standalone
anyways.

Update flake.lock
2021-02-07 19:43:22 +00:00
Andika Demas Riyandi
2d9f3716e2
Merge pull request #44 from numtide/group-commands
refactor: group commands together
2021-02-07 07:26:38 +07:00
zimbatm
472383dfe8
refactor: group commands together
Remove a bit of code complexity by grouping all the commands together.
2021-02-06 20:53:55 +01:00
zimbatm
8702ac12d7
remove unused env_logger crate 2021-02-06 20:51:32 +01:00
zimbatm
fbf923adb9
adjust log levels
Move all of the non-essential outputs to DEBUG level.

For now, debug is the default level but it will be removed in the
future.
2021-02-06 20:16:18 +01:00
zimbatm
b4ece14ab8
logger: add debug level
Allow to log things that will not be displayed by default.
2021-02-06 20:16:18 +01:00
Jonas Chevalier
3fa53f31e6
replace 'which' with crate (#42)
The binary is not available on all platforms.
2021-02-06 19:13:24 +00:00
Andika Demas Riyandi
d9e44c7c83
Merge pull request #41 from numtide/no-mkdir
replace 'mkdir -p' with pure rust
2021-02-06 01:30:56 +07:00
zimbatm
4e43b42208
replace 'mkdir -p' with pure rust 2021-02-05 18:58:57 +01:00
Andika Demas Riyandi
2bbe6e598a
Merge pull request #38 from numtide/basile/formatter-changes
Invalidate cached format on command/option modification
2021-02-05 17:30:47 +07:00
Andika Demas Riyandi
9fc0c32cbd
Merge pull request #39 from numtide/basile/multiple-files
Pass multiple paths to a formatter
2021-02-05 17:29:14 +07:00
Basile Henry
ec3f67922e Pass multiple paths to a formatter
This reduces the number of exec calls to the formatters

If we have too many paths it's possible to hit ARG_MAX (though unlikely
on modern Linux systems).
We could chunk the paths into a more reasonable size if this becomes an
issue.
See: https://www.in-ulm.de/~mascheck/various/argmax/
2021-02-05 08:56:36 +01:00
Basile Henry
1cebf18bde Invalidate cached format on command/option modification 2021-02-05 08:27:10 +01:00
Andika Demas Riyandi
5b87d5e8ee
Merge pull request #37 from numtide/shfmt
examples: add shfmt
2021-02-05 05:43:25 +07:00
zimbatm
e0755631c9
examples: add shfmt 2021-02-04 17:46:00 +01:00
Andika Demas Riyandi
51bf562484
Merge pull request #36 from numtide/adding-formatter
Add javascript, golang, and python formatter to examples folder
2021-02-04 23:34:59 +07:00