misc/importsort-d

README.md in v0.3.0
Repositories | Summary | Log | Files | README.md

README.md (2791B) download


 1# Sort Imports for [D](https://dlang.org/)
 2
 3<img src="assets/importsort-d.png" alt="logo" width="256" /> 
 4
 5`sortimport-d` can sort your dozens of `import`'s in a `.d` file (no matter where)
 6
 7## Installation
 8
 9## Prerequisite
10
11- [`dub`](https://dub.pm/)
12
13### Building from HEAD
14
15Get the repository with `git` and compile everything with `dub`
16```
17$ git clone https://github.com/friedelschoen/importsort-d
18$ cd importsort-d
19$ dub build
20```
21
22If everything went fine, there should be a binary at `bin/importsort-d`.
23
24Copy this into a directory included in `$PATH` (`/usr/bin` for example) to make this command work globally.
25
26### Building with DUB
27
28```
29$ dub fetch importsort-d
30$ dub run importsort-d -- --help
31```
32
33This won't install the command globally, you always have to run `dub run importsort-d <args>`
34
35## Usage
36
37```
38$ importsort-d [-h] [-v] [-r] [-i] [-o <out>] [-k] [-a] [-r] <input...>
39```
40`input` may be omitted or set to `-` to read from STDIN
41
42| option                | description                                    |
43| --------------------- | ---------------------------------------------- |
44| `-h, --help`          | prints a help message                          |
45| `-v, --verbose`       | prints useful debug messages                   |
46|                       |                                                |
47| `-k, --keep`          | keeps the line as-is instead of formatting     |
48| `-a, --attribute`     | public and static imports first                |
49| `-b, --binding`       | sorts by binding rather then the original      |
50|                       |                                                |
51| `-r, --recursive`     | recursively search in directories              |
52| `-i, --inline`        | changes the input                              |
53| `-o, --output <path>` | writes to `path` rather then writing to STDOUT |
54
55## TODO's
56
57- [x] recursive searching (`v0.2.0`)
58- [ ] watch-mode (struggling with save-timings - can clear files)
59  - you can add importsort-d into your onSave-hooks (e. g. [Run on Save](https://marketplace.visualstudio.com/items?itemName=emeraldwalk.RunOnSave) on VSCode)
60- [ ] support multiple imports in one line (demilited by `;`)
61- [x] merge imports (`v0.3.0`)
62- [ ] stripping unused imports (maybe)
63
64## Changelog
65
66### `v0.1.0`
67- the very first version
68- not a lot is implemented
69
70### `v0.2.0`
71- added `--recursive` (see above)
72- option `--keep` becomes disabling formatting
73- option `--inline` doen't copy the original but creates a `*.new` and renames it afterwards
74- option `--original` becomes `--binding` and sorts by original by default
75- refactoring code
76
77## License
78
79This whole project is licensed under the beautiful terms of the `zlib-license`.
80
81Further information [here](LICENSE)
82
83> made with love and a lot of cat memes