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

rust-script fails to install file association #57

Closed
azzamsa opened this issue Sep 28, 2022 · 2 comments
Closed

rust-script fails to install file association #57

azzamsa opened this issue Sep 28, 2022 · 2 comments

Comments

@azzamsa
Copy link

azzamsa commented Sep 28, 2022

Hi.

rust-script fails to install file association.

❯ rust-script --install-file-association
error: Found argument '--install-file-association' which wasn't expected, or isn't valid in this context

        If you tried to supply `--install-file-association` as a value rather than a flag, use `-- --install-file-association`

USAGE:
    rust-script [OPTIONS] [--] [script]...

For more information try --help

bin/bin/public on  master [!]
❯ rust-script --version
rust-script 0.21.0
OS: Fedora Linux 36 (Workstation Edition) x86_64
Kernel: 5.19.11-200.fc36.x86_64
Shell: zsh 5.8.1
DE: GNOME 42.5
WM: Mutter
@memark
Copy link

memark commented Nov 2, 2022

You can only (and only need to) do this on Windows. On your system adding a shebang to your script should be enough.

From docs at https://rust-script.org/#executable-scripts:

Executable Scripts

On Unix systems, you can use #!/usr/bin/env rust-script as a shebang line in a Rust script. This will allow you to execute a script files (which don’t need to have the .rs file extension) directly.

If you are using Windows, you can associate the .ers extension (executable Rust - a renamed .rs file) with rust-script. This allows you to execute Rust scripts simply by naming them like any other executable or script.

This can be done using the rust-script --install-file-association command. Uninstall the file association with rust-script --uninstall-file-association.

If you want to make a script usable across platforms, use both a shebang line and give the file a .ers file extension.

@azzamsa
Copy link
Author

azzamsa commented Nov 3, 2022

You can only (and only need to) do this on Windows. On your system adding a shebang to your script should be enough.

Oh, Thank you!

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

No branches or pull requests

2 participants