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

ucm run : Numeric arguments are changed to find results #2805

Open
hagl opened this issue Jan 14, 2022 · 3 comments · May be fixed by #5480
Open

ucm run : Numeric arguments are changed to find results #2805

hagl opened this issue Jan 14, 2022 · 3 comments · May be fixed by #5480

Comments

@hagl
Copy link
Contributor

hagl commented Jan 14, 2022

When running a main function in ucm a numeric argument is replaced by the potential last result of a find command:

main _ = printLine ("Hello " ++ Optional.getOrElse "" (head !getArgs) ++ "!")
.> run main 1
Hello 1!
.> find isAscii

  1. base.Char.ascii.isAscii : Char -> Boolean
  2. base.Char.ascii.isAscii.doc : Doc.Deprecated
  

.> run main 1  
Hello base.Char.ascii.isAscii#o1nnl7n4cpa2ddq66u50cda6ns8d6uo2j3gngcm70071rub2gq9n10kfemhvij3dk6rohigvn7os91gh5j9pbg6nk84noq39pm9luio!

See this discussion on Slack: https://unisonlanguage.slack.com/archives/CLUNF0J5S/p1642108647023800

@iacore
Copy link

iacore commented May 6, 2022

same problem here

main : '{IO, Exception} ()
main _ = let
  use Text ++
  printLine "Hello world"
  args = !getArgs
  List.foldLeft
    (i arg -> let
      printLine (toText i ++ ": " ++ arg)
      i + 1) 0 args
  ()
$ ucm
.> find
# exit find
.> run main 0 1
Hello world
0: 0
1: add_mul#bl5qhvd4r9qdnm01vhksm6ekve2l1ibbp36p5qjeq8bsh0cokkepl22otlhp5f982a410u08714j7jse5lkontk97c9q9il53ct7nh8

@aryairani
Copy link
Contributor

Can we change it from a pre-step to a per-argument thing, have it be part of the argumentType? IIRC we want substitution for everything except args 2+ when running.

@aryairani
Copy link
Contributor

Even a workaround like clearing the numbered args would be better than nothing.

@sellout sellout self-assigned this Nov 27, 2024
sellout added a commit to sellout/unison that referenced this issue Nov 27, 2024
Previously, it was impossible to, say, pass numbers to `run foo`,
because they would be parsed as numbered args, and then would error when
a non-string was given as a command-line arg. This now replaces all
usage of `unsupportedStructuredArgument` (which would fail on numbers)
with handling of the original string.

This improves the following commands:
- `load`
- `display.to`
- `debug.tab-complete`
- `debug.lsp-name-completion`
- `debug.fuzzy-options`
- `help-topics`
- `help`
- `docs.to-html`
- `run`
- `compile`
- `run.native`
- `compile.native`
- `create.author`
- `release.draft`

Fixes unisonweb#2805.
sellout added a commit to sellout/unison that referenced this issue Nov 27, 2024
Previously, it was impossible to, say, pass numbers to `run foo`,
because they would be parsed as numbered args, and then would error when
a non-string was given as a command-line arg. This now replaces all
usage of `unsupportedStructuredArgument` (which would fail on numbers)
with handling of the original string.

This improves the following commands:
- `load`
- `display.to`
- `debug.tab-complete`
- `debug.lsp-name-completion`
- `debug.fuzzy-options`
- `help-topics`
- `help`
- `docs.to-html`
- `run`
- `compile`
- `run.native`
- `compile.native`
- `create.author`
- `release.draft`

Fixes unisonweb#2805.
sellout added a commit to sellout/unison that referenced this issue Dec 4, 2024
This allows us to incrementally expand numbered arguments, only doing so when
we want a Unison value and not unstructured text.

Fixes unisonweb#2805.
@sellout sellout linked a pull request Dec 5, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants