alire-project / alire

Command-line tool from the Alire project and supporting library
GNU General Public License v3.0
278 stars 49 forks source link

Suggestion: `display` property #1263

Closed jquorning closed 1 year ago

jquorning commented 1 year ago

I hereby suggest a display property in the TOML file. The purpose of display is to have a human readable project name;

name : formal / technical name of crate display: human readable name of crate

If display does not exist then fallback on name

Examples:

Pro:

Con: A little added complexity

Implementation complexity: Minor / Moderate

mosteo commented 1 year ago

Looks like a nice idea. I'd go for display_name though.

Fabien-Chouteau commented 1 year ago

I think it will be quickly confusing to know which name to use on the command line or in alire.toml.

There's also a big issue of spoofing. Are display names unique? How do we make sure no one makes a gtkadd crate with a GTKAda display names?

The crate names are not number ids, they are already human readable identifiers. And there's the short description to provide a little extra context if needed.

mosteo commented 1 year ago

Valid points. Closing then.

jquorning commented 1 year ago

Not so fast; I would like to have this issue reopened, Please..

There should be some mapping rules, like:

subtype ASCII_String      is String with ...;
subtype UTF8_String       is String with ...;
subtype Type_Crate_Name   is ASCII_String with ...;
subtype Type_Display_Name is UTF8_String  with ...;

function Is_Valid
  (Crate_Name : Type_Crate_Name)
   return Boolean
is
begin
   if To_Ada_Case (Crate_Name) = Display_Name then
      return True;
   end if;
   ...
   return False;
end Is_Valid;

function Is_Valid
  (Display_Name : Type_Display_Name)
   return Boolean
is
begin
   if To_Lower_Case (Display_Name) = Crate_Name then
      return True;
   end if;
   ...
   Return False;
end Is_Valid;

function Default (Crate_Name : Type_Name) return Type_Display_Name
  is (To_Ada_Case (Crate_Name));

function Default (Display_Name : Type_Display_Name) return Type_Crate_Name
  is (To_Lower_Case (Display_Name));

display_name should be optional falling back to current scheme as default.

@Fabien-Chouteau : I thougt is saw display in Homebrew or somewhere. display_name is better, Thanks!

jquorning commented 1 year ago

@Fabien-Chouteau the idea of display_name is to have a nice human readable form for alire.ada.dev; I should have said thad, sorry.

Maybe display_name could be some kind of annotation, not part of the create toml file.

And @Fabien-Chouteau; I would like to congratulate you with winning the prize. It is fully deserved imho.

Fabien-Chouteau commented 1 year ago

@Fabien-Chouteau the idea of _displayname is to have a nice human readable form for alire.ada.dev; I should have said thad, sorry.

I understood in the first message. For me the added benefit is not worth the added complexity, potential confusion, and spoofing risk.

Maybe _displayname could be some kind of annotation, not part of the create toml file.

We don't want to have more files or sources of truth.

And @Fabien-Chouteau; I would like to congratulate you with winning the prize. It is fully deserved imho.

Thanks :)