@@ -22,6 +22,7 @@ The `cargo-featalign` tool offers the following features:
2222- Printing the dependency path
2323- Performing a dry run before overwriting
2424- Automatically aligning/fixing missing features
25+ - Sorting alphabetically while aligning
2526
2627### Installation
2728- From GitHub: [ ` github.com/hack-ink/cargo-featalign/releases/latest ` ] ( https://github.com/hack-ink/**cargo-featalign/releases/latest )
@@ -34,7 +35,7 @@ cargo featalign --help
3435```
3536Cargo features alignment tool.
3637
37- Usage: featalign [OPTIONS] --features <[NAME]> [PATH]
38+ Usage: cargo- featalign [OPTIONS] --features <[NAME]> [PATH]
3839
3940Arguments:
4041 [PATH]
@@ -45,6 +46,9 @@ Arguments:
4546 [default: ./Cargo.toml]
4647
4748Options:
49+ --features <[NAME]>
50+ Features to process
51+
4852 --thread <NUM>
4953 Number of threads to use.
5054
@@ -63,8 +67,16 @@ Options:
6367 [default: overwrite]
6468 [possible values: check, dry-run, dry-run2, overwrite]
6569
66- --features <[NAME]>
67- Features to process
70+ --indent-symbol <INDENT_SYMBOL>
71+ Use the given symbol for indentation
72+
73+ [default: tab]
74+ [possible values: tab, whitespace]
75+
76+ --indent-size <SIZE>
77+ The number of spaces used for indentation
78+
79+ [default: 4]
6880
6981 --workspace-only
7082 Determines whether to process only workspace members
@@ -79,20 +91,12 @@ Options:
7991
8092 Use `-1` to process the entire tree.
8193
82- !! Running with this flag under a large project, even with 128 threads configured, is incredibly challenging.
94+ !! Running with this flag under a large project, even with 128 threads configured, is incredibly challenging.
8395
8496 [default: 0]
8597
86- --indent-symbol <INDENT_SYMBOL>
87- Use the given symbol for indentation
88-
89- [default: tab]
90- [possible values: tab, whitespace]
91-
92- --indent-size <SIZE>
93- The number of spaces used for indentation
94-
95- [default: 4]
98+ --sort
99+ Wether to sort the required features while aligning
96100
97101 --verbose
98102 Verbose output
@@ -487,3 +491,65 @@ cargo featalign mock --features std,runtime-benchmarks,try-runtime --workspace-o
487491``` sh
488492diff mock/Cargo.toml mock/Cargo.toml.cargo-featalign.swap
489493```
494+
495+ #### Sorting
496+ ``` sh
497+ cargo featalign mock --features std,runtime-benchmarks,try-runtime --workspace-only --default-std --depth -1 --mode dry-run --sort
498+ ```
499+ ``` diff
500+ @@ -16,5 +16,6 @@
501+ [features]
502+ default = ["std"]
503+ std = [
504+ + "nested-b/std",
505+ "nested-d/std",
506+ ]
507+
508+ nested-b 0.0.0 (path+file:///root/code/hack-ink/cargo-featalign/mock/nested/b)
509+ @@ -14,4 +14,6 @@
510+
511+ [features]
512+ default = ["std"]
513+ - std = []
514+ + std = [
515+ + "nested-c/std",
516+ + ]
517+
518+ mock-runtime 0.0.0 (path+file:///root/code/hack-ink/cargo-featalign/mock)
519+ @@ -48,24 +48,34 @@
520+ "pallet-b/std",
521+ "pallet-c/std",
522+ # "pallet-d/std",
523+ + "pallet-a/std",
524+ + "pallet-d/std",
525+ "primitive-a/std",
526+ ]
527+
528+ runtime-benchmarks = [
529+ "pallet-a/runtime-benchmarks",
530+ # "pallet-b/runtime-benchmarks",
531+ + "pallet-b/runtime-benchmarks",
532+ "pallet-c/runtime-benchmarks",
533+ + "pallet-d/runtime-benchmarks",
534+ # "pallet-d/runtime-benchmarks",
535+ ]
536+
537+ try-runtime = [
538+ "pallet-a/try-runtime",
539+ "pallet-b/try-runtime",
540+ + "pallet-c/try-runtime",
541+ + "pallet-d/try-runtime",
542+ # "pallet-c/try-runtime",
543+ # "pallet-d/try-runtime",
544+ ]
545+
546+ - empty = []
547+ + empty = [
548+ + "primitive-b/empty",
549+ + "primitive-c/empty",
550+ + "primitive-d/empty",
551+ + ]
552+
553+ [workspace]
554+ resolver = "2"
555+ ```
0 commit comments