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

Change actonc argument #608

Merged
merged 2 commits into from
Apr 26, 2022
Merged

Change actonc argument #608

merged 2 commits into from
Apr 26, 2022

Conversation

plajjan
Copy link
Contributor

@plajjan plajjan commented Apr 26, 2022

The argument parsing of actonc has now been changed to support the
concept of commands.

We used to take a single mandatory argument, which was expected to be a
file path. If the file ended with .act, we would compile it whereas if
it was a .ty file we would dump its content. E.g. valid use cases:

actonc foo.act
actonc foo.ty

We now take a single mandatory argument, which is expected to be a
command. As a shortcut, we do still support being passed a .act file and
will then compile it, which means we are also somewhat backwards
compatible. For example:

actonc foo.act

Dumping the content of a file is however not supported by just sending
in a file path as the only argument. There is a new command, aptly named
"dump" which in turn accepts an option --file for the filename of the
.ty file to dump. For example

actonc dump --file foo.ty

There's also a build command, but it's not yet implemented:

actonc build

The idea is that it should build an entire Acton project.

I noticed, after implementing this, that Options.Applicative that we use
for argument parsing has support for something it calls "commands",
which is probably something we want to use. I assume it will give us
arguments that are per command rather than as now, where arguments are
global and could potentially mean different thing for different
commands.

Part of #594.

@plajjan plajjan force-pushed the 594-actonc-add-cmd-to-args branch 2 times, most recently from eb7551a to 4d9ac9e Compare April 26, 2022 11:48
The argument parsing of actonc has now been changed to support the
concept of commands.

We used to take a single mandatory argument, which was expected to be a
file path. If the file ended with .act, we would compile it whereas if
it was a .ty file we would dump its content. E.g. valid use cases:

  actonc foo.act
  actonc foo.ty

We now take a single mandatory argument, which is expected to be a
command. As a shortcut, we do still support being passed a .act file and
will then compile it, which means we are also somewhat backwards
compatible. For example:

  actonc foo.act

Dumping the content of a file is however not supported by just sending
in a file path as the only argument. There is a new command, aptly named
"dump" which in turn accepts an option --file for the filename of the
.ty file to dump. For example

  actonc dump --file foo.ty

There's also a build command, but it's not yet implemented:

  actonc build

The idea is that it should build an entire Acton project.

I noticed, after implementing this, that Options.Applicative that we use
for argument parsing has support for something it calls "commands",
which is probably something we want to use. I assume it will give us
arguments that are per command rather than as now, where arguments are
global and could potentially mean different thing for different
commands.
And some other cleanups
@plajjan plajjan merged commit 6fe3ead into main Apr 26, 2022
@plajjan plajjan deleted the 594-actonc-add-cmd-to-args branch April 26, 2022 12:32
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 this pull request may close these issues.

None yet

1 participant