diff --git a/Trunk.toml b/Trunk.toml
new file mode 100644
index 0000000..95fc26b
--- /dev/null
+++ b/Trunk.toml
@@ -0,0 +1,5 @@
+[build]
+target = "index.html"
+release = true
+dist = "dist"
+public_url = "/~ashe/preview/"
diff --git a/index.html b/index.html
index fa24613..67fe989 100644
--- a/index.html
+++ b/index.html
@@ -2,11 +2,12 @@
+
+
diff --git a/res/about.md b/res/about.md
new file mode 100644
index 0000000..df77585
--- /dev/null
+++ b/res/about.md
@@ -0,0 +1,14 @@
+# Ashe
+
+Hello friend! 💜
+
+My name is Ashe, but in various places around the
+internet I also go by Tempest or Dawn.
+
+## Who am I?
+
+A trans mother, wife, and web developer. (she/her)
+
+I make websites and other dreams for computers,
+primarily with JS but also occasionally Rust, C#, or
+even bash.
diff --git a/res/ashe.gay.md b/res/ashe.gay.md
new file mode 100644
index 0000000..66c4083
--- /dev/null
+++ b/res/ashe.gay.md
@@ -0,0 +1,9 @@
+# ashe.gay
+
+This is my personal blog - I use this to post my
+thoughts, experiences, and occasionally bad poetry.
+
+Built with:
+ - [React](https://reactjs.org/)
+ - [NextJS](https://nextjs.org/)
+ - [Gitlab Pages](https://gitlab.com/pages)
diff --git a/res/contact.md b/res/contact.md
new file mode 100644
index 0000000..780c28f
--- /dev/null
+++ b/res/contact.md
@@ -0,0 +1,12 @@
+# Contact me
+
+## IRC
+
+I hang out on tilde.chat as
, and on Libera
+as
+
+## Email
+
+I check ashe@tilde.club every once in a while, I
+also have ashe@tempest.dev that I check much more
+regularly.
diff --git a/res/tempest.dev.md b/res/tempest.dev.md
new file mode 100644
index 0000000..70a5cee
--- /dev/null
+++ b/res/tempest.dev.md
@@ -0,0 +1,10 @@
+# tempest.dev
+
+This is my development blog - I haven't updated it in
+a while, but intend to come back to it and post
+guides, write-ups, experiments, etc.
+
+Built with:
+ - [React](https://reactjs.org/)
+ - [NextJS](https://nextjs.org/)
+ - [Docker](https://www.docker.com/)
diff --git a/res/~ashe.md b/res/~ashe.md
new file mode 100644
index 0000000..04e084d
--- /dev/null
+++ b/res/~ashe.md
@@ -0,0 +1,12 @@
+# tilde.club/~ashe/
+
+That's this page!
+
+This was built as something of an experiment, just to
+see if I _could_. This obviously isn't a real server
+environment, but if you thought it was for a moment
+then I consider this a success.
+
+Built with:
+ - [Rust](https://www.rust-lang.org/)
+ - [wasm-bindgen](https://docs.rs/wasm-bindgen/)
diff --git a/src/commands.rs b/src/commands.rs
index 1a1909a..6e5f68f 100644
--- a/src/commands.rs
+++ b/src/commands.rs
@@ -2,8 +2,14 @@ use std::str::FromStr;
use crate::{Directory, State};
-static PROJECTS_DIR: &'static str = "stuff";
-static HOME_DIR: &'static str = "projects";
+static PROJECTS_DIR: &'static str = "~ashe ashe.gay tempest.dev";
+static HOME_DIR: &'static str = "about.md contact.md \x1b[0;36mprojects\x1b[0m";
+
+static ABOUT: &'static str = include_str!("../res/about.md");
+static CONTACT: &'static str = include_str!("../res/contact.md");
+static ASHE_GAY: &'static str = include_str!("../res/ashe.gay.md");
+static TEMPEST_DEV: &'static str = include_str!("../res/tempest.dev.md");
+static TILDE_ASHE: &'static str = include_str!("../res/~ashe.md");
pub fn handle_command(command_string : String, state : &mut State) {
let mut words = command_string.split(' ');
@@ -78,9 +84,54 @@ pub fn handle_command(command_string : String, state : &mut State) {
_ => state.output.push_back(format!("bash: ls: too many arguments"))
}
}
+
+ "cat" => match args.len() {
+ 0 => state.output.push_back(format!("bash: cat: too few arguments")),
+ 1 => match state.current_working_directory {
+ Directory::Home => match args[0] {
+ "about.md" => output_file(ABOUT, args[0], state),
+ "contact.md" => output_file(CONTACT, args[0], state),
+ "projects/ashe.gay" => output_file(ASHE_GAY, args[0], state),
+ "projects/tempest.dev" => output_file(TEMPEST_DEV, args[0], state),
+ "projects/~ashe" => output_file(TILDE_ASHE, args[0], state),
+ _ => state.output.push_back(format!("bash: cat: {}: No such file or directory", args[0]))
+ },
+ Directory::Projects => match args[0] {
+ "../about.md" => output_file(ABOUT, args[0], state),
+ "../contact.md" => output_file(CONTACT, args[0], state),
+ "ashe.gay" => output_file(ASHE_GAY, args[0], state),
+ "tempest.dev" => output_file(TEMPEST_DEV, args[0], state),
+ "~ashe" => output_file(TILDE_ASHE, args[0], state),
+ _ => state.output.push_back(format!("bash: cat: {}: No such file or directory", args[0]))
+ },
+ },
+ _ => state.output.push_back(format!("bash: cat: too many arguments"))
+ },
_ => {
state.output.push_back(format!("bash: {}: command not found", command));
}
}
+}
+
+fn output_file(file_string : &str, path : &str, state : &mut State) {
+ let header = "───────┬───────────────────────────────────────────────────────";
+ let divider = "───────┼───────────────────────────────────────────────────────";
+ let footer = "───────┴───────────────────────────────────────────────────────";
+
+ state.print(String::from_str(header).unwrap());
+ state.print(format!(" │ File: {}", path));
+ state.print(String::from_str(divider).unwrap());
+
+ let lines = file_string.split('\n');
+
+ for (index, line) in lines.enumerate() {
+ if index == 0 && line == "" {
+ state.print(format!(" {:<2} │ {}", index + 1, "\x1b[0;33m\x1b[0m"));
+ } else {
+ state.print(format!(" {:<2} │ {}", index + 1, line));
+ }
+ }
+
+ state.print(String::from_str(footer).unwrap());
}
\ No newline at end of file
diff --git a/src/io.rs b/src/io.rs
index cab0013..7be9317 100644
--- a/src/io.rs
+++ b/src/io.rs
@@ -77,7 +77,7 @@ pub fn handle_key_event(state : &mut State, key : Key) -> Option {
return None
}
-#[wasm_bindgen(inline_js = "const ansi_up = new AnsiUp; export function format_html(text) { return ansi_up.ansi_to_html(text).replace(/(https:[^ ]*)/g, '$1') }")]
+#[wasm_bindgen(inline_js = "const ansi_up = new AnsiUp; export function format_html(text) { return ansi_up.ansi_to_html(text).replace(/(https:[^ )]*)/g, '$1') }")]
extern "C" {
fn format_html(text : String) -> String;
}
diff --git a/src/main.rs b/src/main.rs
index d38a1e9..2dc0a4b 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -42,6 +42,14 @@ impl State {
current_working_directory: Directory::Home
}
}
+
+ pub fn print(&mut self, line : String) {
+ self.output.push_back(line);
+
+ if self.output.len() > self.max_rows {
+ self.output.pop_front();
+ }
+ }
}
fn main() {