I propose to introduce an enum with 3 constructors. This should allow us to support more OSes in the future if we ever need. And it'll help to improve error messages easily.
So the issue includes the following tasks:
[x] Create a new enum with 3 OSes
[x] Create a function to get the current value of enum based on the above matching logic
[ ] Use enum in get_name_by_os
[ ] Implement the Display trait for enum to match the TOML configuration format
Currently,
tool-sync
matches the value ofenv::consts::OS
with the hardcoded string to extract the relevant part of the asset name:https://github.com/chshersh/tool-sync/blob/df7d4768c9cff2a91616bd9686bc928a52fc8c10/src/model/asset_name.rs#L18-L22
I propose to introduce an
enum
with 3 constructors. This should allow us to support more OSes in the future if we ever need. And it'll help to improve error messages easily.So the issue includes the following tasks:
enum
with 3 OSesenum
inget_name_by_os
Display
trait for enum to match the TOML configuration formathttps://github.com/chshersh/tool-sync/blob/df7d4768c9cff2a91616bd9686bc928a52fc8c10/src/model/release.rs#L36-L40
It should be something like: