pressly / sup

Super simple deployment tool - think of it like 'make' for a network of servers
https://pressly.github.io/sup
MIT License
2.48k stars 178 forks source link

Print usage items (networks/targets/commands) in order #108

Closed zyguan closed 6 years ago

zyguan commented 7 years ago

When printing usage, networkUsage and cmdUsage iterate the maps directly, which may lead to different outputs (not in a same order) every time.

1485307471

This PR just sorts the names of available networks/targets/commands before iterating and printing them so that they are listed by alphabetical order.

VojtechVitek commented 7 years ago

No worries. Thanks for the PR!

Can you share a sample output with your changes applied, so we can discuss the feature with others?

zyguan commented 7 years ago

Hi, @VojtechVitek , I just updated the description of this PR. Is it clear enough?

VojtechVitek commented 7 years ago

@zyguan thanks for clarification. This is nice addition.

I just wonder if printing the original order from Supfile wouldn't be better. This would require us to change the underlying map into a slice. What do you think?

But this is a step forward anyway. We could merge it as is, if you will.

zyguan commented 7 years ago

@VojtechVitek I agree with you, Printing the original order from Supfile is a better idea. But I wonder if other users also approve it. If so, I'm willing to update this PR.

VojtechVitek commented 7 years ago

@zyguan please do, I heard 5+ requests for this already :)

zyguan commented 7 years ago

Hi, @VojtechVitek ! I just replaced the networks map with a slice of NamedNetwork in fad7ef3, does it look good to you?

It's straightforward but a little inefficient since it will call unmarshal twice! Do you have any better solution?

Maybe I'd better rename the type Networks to NamedNetworks...

zyguan commented 7 years ago

@VojtechVitek I just updated this PR, please correct me if I did something wrong :)

VojtechVitek commented 7 years ago

@zyguan thanks! I'll check it out later today.

zyguan commented 7 years ago

@VojtechVitek take your time :)