mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Add rustfmt command to devenv commands
This commit is contained in:
parent
0b35a67260
commit
fc0a86c038
1 changed files with 13 additions and 0 deletions
|
@ -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())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue