Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

report aliases in our help #68

Closed
skx opened this issue Oct 27, 2022 · 0 comments · Fixed by #69
Closed

report aliases in our help #68

skx opened this issue Oct 27, 2022 · 0 comments · Fixed by #69

Comments

@skx
Copy link
Owner

skx commented Oct 27, 2022

Currently aliased functions show up twice:

frodo ~/Repos/github.com/skx/yal $ ./yal -h hms
hms
===
Return the current time as a string, formatted as 'HH:MM:SS'.


time:hms
========
Return the current time as a string, formatted as 'HH:MM:SS'.


zero-pad-single-number (num:number)
===================================
Return the given number, padded to two digits, as a string.
i.e. Add a '0' prefix to the specified number, for values less than ten.

This is designed to pad the hours, minutes, and seconds in (hms).

If we added an "Alias string" method to the primitives we could set that in the (alias ..), which would allow:

..

hms
===

This is an alias of the function (time:hms)
..

It wouldn't make a massive amount of difference, but it would be cute!

skx added a commit that referenced this issue Oct 28, 2022
This pull request closes #68 by showing aliased functions specially
in the output of yal when running with "-h".

For example:

```
$ ./yal  -h hms
hms
===
hms is an alias for time:hms.

time:hms
========
Return the current time as a string, formatted as 'HH:MM:SS'.

zero-pad-single-number (num:number)
===================================
Return the given number, padded to two digits, as a string.
i.e. Add a '0' prefix to the specified number, for values less than ten.

This is designed to pad the hours, minutes, and seconds in (hms).

```

When called via `(help)` everything works as-is, so there is no
mention of the alias when this code runs:

```
(print (help hms))
```

(Because we don't have access to the name, to lookup the function,
we just the result, when our arguments are expanded.)
@skx skx closed this as completed in #69 Oct 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant