crap
crap copied to clipboard
Rethinking crap.json
When I wrote this tool, I wanted the resulting .json file to be editable by the user without breaking functionality. My reasoning for this was both for ease of use and to be able to use it in, say, a dotfiles repository for easy setup.
Currently with crap
an alias may be written to an alias, but the new alias is simply added with the value of the original alias, so if the original value is changed the two aliases no longer match. Example: if I add an alias inputfilter
to zendframework/input-filter:^2.7
and then I add an alias input-filter
to inputfilter
, I now have a crap.json that looks like:
{
"inputfilter": "zendframework/input-filter:^2.7",
"input-filter": "zendframework/input-filter:^2.7"
}
Continuing with the example scenario, if I change inputfilter
to alias to zendframework/input-filter:^2.6
, the value for input-filter
is still "zendframework/input-filter:^2.7".
When I added this feature (alias to alias) I was mostly using it to prevent typos, especially in the case of packages with hyphens, as in the example above. Ideally, aliases to other aliases would link somehow and edits to one would edit another, but this would require a change in the json file structure to one not easily edited by hand.
So, I must decide if I value editing the json file easily, or better alias-package mapping more.