From ef0a97f6ca6ca8694dcddce28056a557a1b468cb Mon Sep 17 00:00:00 2001
From: csc530 <77406318+csc530@users.noreply.github.com>
Date: Wed, 31 Jul 2024 19:07:24 -0400
Subject: [PATCH] :sparkles: add ability to add education to resume
created CRUD commands and added education to md and txt export formats
---
.run/add education.run.xml | 20 ++++
.run/edit education.run.xml | 20 ++++
.run/get educations.run.xml | 20 ++++
Resumer/Helpers.cs | 14 ++-
.../Migrations/ResumeContextModelSnapshot.cs | 21 +---
Resumer/Program.cs | 29 +++++
Resumer/cli/commands/ExportCommand.cs | 31 +++++-
.../cli/commands/add/AddEducationCommand.cs | 57 ++++++++++
.../commands/delete/DeleteEducationCommand.cs | 9 ++
.../cli/commands/edit/EditEducationCommand.cs | 56 ++++++++++
.../cli/commands/get/GetEducationCommand.cs | 58 ++++++++++
Resumer/models/Education.cs | 10 +-
Resumer/models/Profile.cs | 3 +-
Resumer/models/Resume.cs | 105 +++++++++++-------
Resumer/models/ResumeContext.cs | 1 +
Resumer/models/TypstTemplate.cs | 8 +-
16 files changed, 387 insertions(+), 75 deletions(-)
create mode 100644 .run/add education.run.xml
create mode 100644 .run/edit education.run.xml
create mode 100644 .run/get educations.run.xml
create mode 100644 Resumer/cli/commands/add/AddEducationCommand.cs
create mode 100644 Resumer/cli/commands/delete/DeleteEducationCommand.cs
create mode 100644 Resumer/cli/commands/edit/EditEducationCommand.cs
create mode 100644 Resumer/cli/commands/get/GetEducationCommand.cs
diff --git a/.run/add education.run.xml b/.run/add education.run.xml
new file mode 100644
index 0000000..ddde93d
--- /dev/null
+++ b/.run/add education.run.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.run/edit education.run.xml b/.run/edit education.run.xml
new file mode 100644
index 0000000..5338d53
--- /dev/null
+++ b/.run/edit education.run.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.run/get educations.run.xml b/.run/get educations.run.xml
new file mode 100644
index 0000000..624a308
--- /dev/null
+++ b/.run/get educations.run.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Resumer/Helpers.cs b/Resumer/Helpers.cs
index d9d8be0..d4b1eb5 100644
--- a/Resumer/Helpers.cs
+++ b/Resumer/Helpers.cs
@@ -1,6 +1,7 @@
using System.Collections;
using System.Collections.Immutable;
using System.Text;
+using System.Text.RegularExpressions;
using Spectre.Console;
namespace Resumer;
@@ -21,13 +22,14 @@ public static partial class Utility
///
/// the type of the prompt input
/// the prompt message
+ /// a of nullable
public static TextPrompt SimplePrompt(string message) =>
- new TextPrompt(message).AllowEmpty().HideDefaultValue().DefaultValue(default);
+ new TextPrompt(message).AllowEmpty().HideDefaultValue().DefaultValue(default(T?));
///
/// the default value
- public static TextPrompt SimplePrompt(string message, T defaultValue) => new TextPrompt(message)
- .AllowEmpty().DefaultValue(defaultValue).HideDefaultValue();
+ public static TextPrompt SimplePrompt(string message, T? defaultValue) =>
+ SimplePrompt(message).DefaultValue(defaultValue);
///
/// converts a string to camel case
@@ -56,7 +58,7 @@ public static string PrintDuration(DateOnly? startDate, DateOnly? endDate = null
startDate == null ? string.Empty : $"{startDate:MMM yyyy} - {endDate?.ToString("MMM yyyy") ?? "present"}";
}
-public static class Extensions
+public static partial class Extensions
{
// todo: inquire about default value being a property - spectre console pr/iss
// .DefaultValue(textPrompt);
@@ -75,6 +77,7 @@ public static string Print(this object? value) =>
null => string.Empty,
bool bit => bit ? "true" : "false",
string txt => txt,
+ Enum @enum => NextToUppercaseRegex().Replace(@enum.ToString(), "$1 $2").Replace('_', '-'),
DictionaryEntry pair => $"{pair.Key.Print()}: {pair.Value.Print()}",
IDictionary dictionary => string.Join("\n", dictionary.Cast