diff options
author | JoshBrudnak <jobrud314@gmail.com> | 2018-08-09 17:26:04 -0400 |
---|---|---|
committer | JoshBrudnak <jobrud314@gmail.com> | 2018-08-09 17:26:04 -0400 |
commit | fc0a86c038f54d90c34da63bcf7a6750e8092b72 (patch) | |
tree | f5ea8bd0602f586b711aa4a757af554f60af1f97 /python/servo/devenv_commands.py | |
parent | 0b35a67260705bbd967ea0b1a74759ca6b3da6ca (diff) | |
download | servo-fc0a86c038f54d90c34da63bcf7a6750e8092b72.tar.gz servo-fc0a86c038f54d90c34da63bcf7a6750e8092b72.zip |
Add rustfmt command to devenv commands
Diffstat (limited to 'python/servo/devenv_commands.py')
-rw-r--r-- | python/servo/devenv_commands.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/python/servo/devenv_commands.py b/python/servo/devenv_commands.py index c6a3f8527ba..c61a5f781e5 100644 --- a/python/servo/devenv_commands.py +++ b/python/servo/devenv_commands.py @@ -227,3 +227,16 @@ class MachCommands(CommandBase): with cd(self.context.topdir): return self.call_rustup_run(["cargo", "fetch"], env=self.build_env()) + + @Command('rustfmt', + description='Format the Rust code using Cargo fmt', + category='devenv') + @CommandArgument( + '--directory', '-d', default=None, + help='Command-line argument to specify the directory for formatting') + def rustfmt(self, directory=""): + if directory == "": + directory = self.context.topdir + + with cd(self.context.topdir): + return self.call_rustup_run(["cargo", "fmt", "--", directory], env=self.build_env()) |