importsort-d 0.2.0

sort imports of a .d-file


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:

Sort Imports for D

<img src="assets/importsort-d.png" alt="logo" width="256" />

sortimport-d can sort your dozens of import's in a .d file (no matter where)

Installation

Prerequisite

Building from HEAD

Get the repository with git and compile everything with dub

$ git clone https://github.com/friedelschoen/importsort-d
$ cd importsort-d
$ dub build

If everything went fine, there should be a binary at bin/importsort-d.

Copy this into a directory included in $PATH (/usr/bin for example) to make this command work globally.

Building with DUB

$ dub fetch importsort-d
$ dub run importsort-d -- --help

This won't install the command globally, you always have to run dub run importsort-d <args>

Usage

$ importsort-d [-h] [-v] [-r] [-i] [-o <out>] [-k] [-a] [-r] <input...>

input may be omitted or set to - to read from STDIN

optiondescription
-h, --helpprints a help message
-v, --verboseprints useful debug messages
-k, --keepkeeps the line as-is instead of formatting
-a, --attributepublic and static imports first
-b, --bindingsorts by binding rather then the original
-r, --recursiverecursively search in directories
-i, --inlinechanges the input
-o, --output <path>writes to path rather then writing to STDOUT

TODO's

  • [x] recursive searching (v0.2.0)
  • [ ] watch-mode (struggling with save-timings - can clear files)
  • you can add importsort-d into your onSave-hooks (e. g. Run on Save on VSCode)
  • [ ] support multiple imports in one line (demilited by ;)
  • [ ] stripping unused imports (maybe)

Changelog

v0.1.0

  • the very first version
  • not a lot is implemented

v0.2.0

  • added --recursive (see above)
  • option --keep becomes disabling formatting
  • option --inline doen't copy the original but creates a *.new and renames it afterwards
  • option --original becomes --binding and sorts by original by default
  • refactoring code

License

This whole project is licensed under the beautiful terms of the zlib-license.

Further information here

made with love and a lot of cat memes

Authors:
  • Friedel Schoen
Dependencies:
none
Versions:
0.3.2 2023-Dec-23
0.3.1 2022-Oct-23
0.3.0 2022-Oct-22
0.2.0 2022-Oct-18
0.1.0 2022-Oct-10
Show all 6 versions
Download Stats:
  • 0 downloads today

  • 0 downloads this week

  • 1 downloads this month

  • 21 downloads total

Score:
0.8
Short URL:
importsort-d.dub.pm