d-import-sort 0.0.2

A D script for sorting import statements.


To use this package, run the following command in your project's root directory:

Manual usage
Put the following dependency into your project's dependences section:

d-import-sort

A tool for sorting import declarations in D.

Usage

$ dub fetch d-import-sort
$ dub run d-import-sort <files>
<<<<filename:minline-maxline
unsorted imports
...
----
sorted imports
...
>>>>
...

Example

$ dub run -- ./source/*.d

<<<<./source/app.d:2-5
import std.string : empty;
import std.stdio : writeln;
import std.file : readText;
----
import std.file : readText;
import std.stdio : writeln;
import std.string : empty;
>>>>

<<<<./source/dimportsort.d:89-92
    import std.algorithm : find;
    import std.range : drop, take;
    import std.algorithm : maxElement, minElement, joiner, splitter;
----
    import std.algorithm : find, joiner, maxElement, minElement, splitter;
    import std.range : drop, take;
>>>>

TODO

  • [x] parse import
  • [x] simple sorted output
  • [x] merge imports for redundant modules
  • [ ] option for overwriting files
  • [ ] color output
  • [ ] diff format output
  • [ ] max line length
Authors:
  • karita
Dependencies:
libdparse
Versions:
0.0.4 2021-Nov-23
0.0.3 2021-Nov-23
0.0.2 2021-Nov-22
0.0.1 2021-Nov-22
~master 2021-Nov-23
Show all 5 versions
Download Stats:
  • 0 downloads today

  • 0 downloads this week

  • 0 downloads this month

  • 9 downloads total

Score:
0.9
Short URL:
d-import-sort.dub.pm