Skip to content

Commit 225c0aa

Browse files
committed
Rename .crs to .ers
1 parent 7cd6461 commit 225c0aa

File tree

6 files changed

+26
-26
lines changed

6 files changed

+26
-26
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,15 +93,15 @@ jobs:
9393
- name: Install file association
9494
run: ./target/debug/rust-script.exe --install-file-association
9595
- name: Run example script with file extension
96-
run: cmd.exe /C .\examples\hello.crs
96+
run: cmd.exe /C .\examples\hello.ers
9797
- name: Run example script without file extension
9898
run: cmd.exe /C hello
9999
working-directory: examples
100100
continue-on-error: true
101101
- name: Uninstall file association
102102
run: ./target/debug/rust-script.exe --uninstall-file-association
103103
- name: Run example script with file extension
104-
run: cmd.exe /C .\examples\hello.crs
104+
run: cmd.exe /C .\examples\hello.ers
105105
continue-on-error: true
106106
- name: Run example script without file extension
107107
run: cmd.exe /C hello

docs/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,15 +96,15 @@ Useful command-line arguments:
9696

9797
## Executable Scripts
9898

99-
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 file directly.
99+
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.
100100

101-
If you are using Windows, you can associate the `.crs` extension (which is simply a renamed `.rs` file) with `rust-script`. This allows you to execute Rust scripts simply by naming them like any other executable or script.
101+
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.
102102

103-
This can be done using the `rust-script --install-file-association` command. It will also allow you to execute `.crs` scripts *without* having to specify the file extension, in the same way that `.exe` and `.bat` files can be used.
103+
This can be done using the `rust-script --install-file-association` command. It will also allow you to execute `.ers` scripts *without* having to specify the file extension, in the same way that `.exe` and `.bat` files can be used.
104104

105105
Uninstall the file association with `rust-script --uninstall-file-association`.
106106

107-
If you want to make a script usable across platforms, use *both* a hashbang line *and* give the file a `.crs` file extension.
107+
If you want to make a script usable across platforms, use *both* a hashbang line *and* give the file a `.ers` file extension.
108108

109109
## Expressions
110110

@@ -127,7 +127,7 @@ The code given is embedded into a block expression, evaluated, and printed out u
127127
You can use `rust-script` to write a quick filter, by specifying a closure to be called for each line read from stdin, like so:
128128

129129
```sh
130-
$ cat now.crs | rust-script --loop \
130+
$ cat now.ers | rust-script --loop \
131131
"let mut n=0; move |l| {n+=1; println!(\"{:>6}: {}\",n,l.trim_right())}"
132132
1: // cargo-deps: time="0.1.25"
133133
3: fn main() {
@@ -138,7 +138,7 @@ $ cat now.crs | rust-script --loop \
138138
You can achieve a similar effect to the above by using the `--count` flag, which causes the line number to be passed as a second argument to your closure:
139139
140140
```sh
141-
$ cat now.crs | rust-script --count --loop \
141+
$ cat now.ers | rust-script --count --loop \
142142
"|l,n| println!(\"{:>6}: {}\", n, l.trim_right())"
143143
1: // cargo-deps: time="0.1.25"
144144
2: fn main() {
File renamed without changes.

src/consts.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ pub const METADATA_FILE: &str = "metadata.json";
154154
/**
155155
Extensions to check when trying to find script input by name.
156156
*/
157-
pub const SEARCH_EXTS: &[&str] = &["crs", "rs"];
157+
pub const SEARCH_EXTS: &[&str] = &["ers", "rs"];
158158

159159
/**
160160
When generating a package's unique ID, how many hex nibbles of the digest should be used *at most*?

src/file_assoc.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@ pub fn install_file_association() -> Result<()> {
3434

3535
let res = (|| -> io::Result<()> {
3636
let hlcr = RegKey::predef(wre::HKEY_CLASSES_ROOT);
37-
let dot_crs = hlcr.create_subkey(".crs")?;
38-
dot_crs.set_value("", &"CargoScript.Crs")?;
37+
let dot_ers = hlcr.create_subkey(".ers")?;
38+
dot_ers.set_value("", &"RustScript.Ers")?;
3939

40-
let cs_crs = hlcr.create_subkey("CargoScript.Crs")?;
41-
cs_crs.set_value("", &"Cargo Script")?;
40+
let cs_ers = hlcr.create_subkey("RustScript.Ers")?;
41+
cs_ers.set_value("", &"Rust Script")?;
4242

43-
let sh_o_c = cs_crs.create_subkey(r#"shell\open\command"#)?;
43+
let sh_o_c = cs_ers.create_subkey(r#"shell\open\command"#)?;
4444
sh_o_c.set_value("", &format!(r#""{}" "%1" %*"#, rcs_path))?;
4545
Ok(())
4646
})();
@@ -67,12 +67,12 @@ pub fn install_file_association() -> Result<()> {
6767
hklm.open_subkey(r#"SYSTEM\CurrentControlSet\Control\Session Manager\Environment"#)?;
6868

6969
let pathext: String = env.get_value("PATHEXT")?;
70-
if !pathext.split(';').any(|e| e.eq_ignore_ascii_case(".crs")) {
71-
let pathext = pathext.split(';').chain(Some(".CRS")).join(";");
70+
if !pathext.split(';').any(|e| e.eq_ignore_ascii_case(".ers")) {
71+
let pathext = pathext.split(';').chain(Some(".ERS")).join(";");
7272
env.set_value("PATHEXT", &pathext)?;
7373
}
7474

75-
println!("Added `.crs` to PATHEXT. You may need to log out for the change to take effect.");
75+
println!("Added `.ers` to PATHEXT. You may need to log out for the change to take effect.");
7676

7777
Ok(())
7878
}
@@ -86,13 +86,13 @@ pub fn uninstall_file_association() -> Result<()> {
8686
let mut notify = || ignored_missing = true;
8787

8888
let hlcr = RegKey::predef(wre::HKEY_CLASSES_ROOT);
89-
hlcr.delete_subkey(r#"CargoScript.Crs\shell\open\command"#)
89+
hlcr.delete_subkey(r#"RustScript.Ers\shell\open\command"#)
9090
.ignore_missing_and(&mut notify)?;
91-
hlcr.delete_subkey(r#"CargoScript.Crs\shell\open"#)
91+
hlcr.delete_subkey(r#"RustScript.Ers\shell\open"#)
9292
.ignore_missing_and(&mut notify)?;
93-
hlcr.delete_subkey(r#"CargoScript.Crs\shell"#)
93+
hlcr.delete_subkey(r#"RustScript.Ers\shell"#)
9494
.ignore_missing_and(&mut notify)?;
95-
hlcr.delete_subkey(r#"CargoScript.Crs"#)
95+
hlcr.delete_subkey(r#"RustScript.Ers"#)
9696
.ignore_missing_and(&mut notify)?;
9797
}
9898

@@ -107,13 +107,13 @@ pub fn uninstall_file_association() -> Result<()> {
107107
hklm.open_subkey(r#"SYSTEM\CurrentControlSet\Control\Session Manager\Environment"#)?;
108108

109109
let pathext: String = env.get_value("PATHEXT")?;
110-
if pathext.split(';').any(|e| e.eq_ignore_ascii_case(".crs")) {
110+
if pathext.split(';').any(|e| e.eq_ignore_ascii_case(".ers")) {
111111
let pathext = pathext
112112
.split(';')
113-
.filter(|e| !e.eq_ignore_ascii_case(".crs"))
113+
.filter(|e| !e.eq_ignore_ascii_case(".ers"))
114114
.join(";");
115115
env.set_value("PATHEXT", &pathext)?;
116-
println!("Removed `.crs` from PATHEXT. You may need to log out for the change to take effect.");
116+
println!("Removed `.ers` from PATHEXT. You may need to log out for the change to take effect.");
117117
}
118118
}
119119

src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,12 +252,12 @@ fn parse_args() -> Args {
252252
let app = app
253253
.arg(
254254
Arg::with_name("install-file-association")
255-
.help("Install a file association so that rust-script executes .crs files.")
255+
.help("Install a file association so that rust-script executes .ers files.")
256256
.long("install-file-association"),
257257
)
258258
.arg(
259259
Arg::with_name("uninstall-file-association")
260-
.help("Uninstall the file association that makes rust-script execute .crs files.")
260+
.help("Uninstall the file association that makes rust-script execute .ers files.")
261261
.long("uninstall-file-association"),
262262
)
263263
.group(

0 commit comments

Comments
 (0)