gleam add
should try to keep [dependencies]
sorted
#3174
bonsairobo
started this conversation in
Ideas & suggestions
Replies: 1 comment 1 reply
-
My wish would be automatically sorted but comments create new groups with a new line above unless it is directly below the section tag |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I find it useful to have my
[dependencies]
sorted. Much easier to read. Not sure about other folks, but the current behavior of appending to the end of the list seems arbitrary.Option A
gleam add
assumes[dependencies]
is already sorted and binary searches for an insertion position.Option B
Always sort
[dependencies]
after inserting a new element. This might annoy people if they have a particular organization strategy, although I can't think of any examples.If people like to do something like:
then
gleam add
could sort the groups separately. This might be annoying to implement though, assuming the first stage of updatinggleam.toml
is to parse the TOML. I'm not sure if this code makes any attempt to preserve spacing, etc.Option C
Check if the list is already sorted. If not,
gleam add
falls back to just inserting at the end.Option D
Add a
--sort
flag togleam add
. Or invert the default to be--unsorted
. Depends on what we want the default behavior to be.Beta Was this translation helpful? Give feedback.
All reactions