Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:

- name: Verify the binary exists
run: |
if [ ! -f ./publish/NihilistShell ]; then
if [ ! -f ./publish/NShell ]; then
echo "[-] - Binary not found!"
exit 1
fi
Expand Down
2 changes: 1 addition & 1 deletion Animation/GlitchOutput.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

namespace NihilistShell.Animation;
namespace NShell.Animation;

/// <summary>
/// The <c>GlitchOutput</c> class provides a method to simulate a "glitch" text animation effect
Expand Down
7 changes: 4 additions & 3 deletions Commands/CdCommand.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
using System.IO;
using NihilistShell.Shell;

using System.IO;
using NShell.Shell;
using Spectre.Console;

namespace NihilistShell.Commands;
namespace NShell.Commands;

public class CdCommand : ICustomCommand
{
Expand Down
5 changes: 3 additions & 2 deletions Commands/SetThemeCommand.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
using NihilistShell.Shell;

using NShell.Shell;
using Spectre.Console;

namespace NihilistShell.Commands
namespace NShell.Commands
{
public class SetThemeCommand : ICustomCommand, IMetadataCommand
{
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion NihilistShell.sln → NShell.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NihilistShell", "NihilistShell.csproj", "{B2886A22-435C-4E2A-A14F-C2A05A0742E6}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NShell", "NShell.csproj", "{B2886A22-435C-4E2A-A14F-C2A05A0742E6}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
19 changes: 10 additions & 9 deletions Program.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@

using Spectre.Console;
using NihilistShell.Shell;
using NihilistShell.Shell.History;
using NihilistShell.Shell.Plugins;
using static NihilistShell.Animation.GlitchOutput;
using NShell.Shell;
using NShell.Shell.Commands;
using NShell.Shell.History;
using NShell.Shell.Plugins;
using static NShell.Animation.GlitchOutput;

public class Program
{
public static readonly string VERSION = "v0.2.1";
public static readonly string GITHUB = "https://github.com/onihilist/NihilistShell";
public static readonly string GITHUB = "https://github.com/onihilist/NShell";

public static async Task Main(string[] args)
{
Expand All @@ -18,22 +19,22 @@ public static async Task Main(string[] args)
{
case "--version":
case "-v":
Console.WriteLine($"NihilistShell {VERSION}");
Console.WriteLine($"NShell {VERSION}");
return;
case "--help":
case "-h":
Console.WriteLine("Usage: nihilistshell [--version | --help]");
Console.WriteLine("Usage: nshell [--version | --help]");
return;
}
}

AnsiConsole.Clear();
AnsiConsole.Markup($"Welcome {Environment.UserName} to NihilistShell !\n\n");
AnsiConsole.Markup($"Welcome {Environment.UserName} to NShell !\n\n");
AnsiConsole.Markup($"\tversion : {VERSION}\n");
AnsiConsole.Markup($"\tgithub : {GITHUB}\n");
AnsiConsole.Markup("\t\n");

AnsiConsole.Markup("[bold cyan][[*]] - Booting NihilistShell...[/]\n");
AnsiConsole.Markup("[bold cyan][[*]] - Booting NShell...[/]\n");
ShellContext context = new();
HistoryManager history = new();
PluginLoader plugins = new();
Expand Down
2 changes: 1 addition & 1 deletion Shell/Commands/CommandLoader.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

using Spectre.Console;

namespace NihilistShell.Shell;
namespace NShell.Shell.Commands;

/// <summary>
/// <c>CommandLoader</c> is responsible for loading custom and system commands.
Expand Down
2 changes: 1 addition & 1 deletion Shell/Commands/CommandParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using Spectre.Console;
using System.Diagnostics;

namespace NihilistShell.Shell;
namespace NShell.Shell.Commands;

/// <summary>
/// <c>CommandParser</c> class handles loading and execution of shell commands.
Expand Down Expand Up @@ -69,7 +69,7 @@

foreach (var cmd in commands)
{
SystemCommands.Add(cmd);

Check warning on line 72 in Shell/Commands/CommandParser.cs

View workflow job for this annotation

GitHub Actions / build

Possible null reference argument for parameter 'item' in 'bool HashSet<string>.Add(string item)'.
var safeCmd = EscapeMarkup(cmd);
//AnsiConsole.MarkupLine($"\t[[[green]+[/]]] Loaded system command: [yellow]{safeCmd}[/]");
}
Expand Down
4 changes: 2 additions & 2 deletions Shell/Commands/CommandRegistry.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

using NihilistShell.Commands;
using NShell.Commands;

namespace NihilistShell.Shell;
namespace NShell.Shell.Commands;

/// <summary>
/// <c>CommandRegistry</c> is responsible for registering all custom commands used in the shell.
Expand Down
2 changes: 1 addition & 1 deletion Shell/Commands/ICustomCommand.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

namespace NihilistShell.Shell;
namespace NShell.Shell;

/// <summary>
/// The <c>ICustomCommand</c> interface defines a contract for implementing
Expand Down
2 changes: 1 addition & 1 deletion Shell/Commands/IMetadataCommand.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

namespace NihilistShell.Shell;
namespace NShell.Shell;

/// <summary>
/// The <c>IMetadataCommand</c> interface defines optional metadata
Expand Down
2 changes: 1 addition & 1 deletion Shell/History/HistoryManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.Collections.Generic;
using System.IO;

namespace NihilistShell.Shell.History
namespace NShell.Shell.History
{
/// <summary>
/// <c>HistoryManager</c> class provide all methods about history.
Expand Down
2 changes: 1 addition & 1 deletion Shell/Plugin/PluginLoader.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

using Spectre.Console;

namespace NihilistShell.Shell.Plugins
namespace NShell.Shell.Plugins
{

/// <summary>
Expand All @@ -10,7 +10,7 @@
public class PluginLoader
{
private string PluginFolderPath { get; set; } = $"/home/{Environment.UserName}/.nihilist_shell/plugins";
public string[] PluginList { get; set; }

Check warning on line 13 in Shell/Plugin/PluginLoader.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable property 'PluginList' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.
public int NumberOfPlugins { get; set; }

public static PluginLoader Instance { get; private set; } = null!;
Expand Down
4 changes: 2 additions & 2 deletions Shell/ShellContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
using System.Linq;
using System.Text.Json;
using System.Text.Json.Nodes;
using NihilistShell.Shell.Themes;
using NShell.Shell.Themes;
using Spectre.Console;

namespace NihilistShell.Shell
namespace NShell.Shell
{
public class ShellContext
{
Expand All @@ -14,7 +14,7 @@
public string Prompt { get; private set; }
public string LSColors { get; private set; }

public ShellContext()

Check warning on line 17 in Shell/ShellContext.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable property 'LSColors' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.

Check warning on line 17 in Shell/ShellContext.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable property 'Prompt' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.
{
CurrentDirectory = Directory.GetCurrentDirectory();
SetPromptAndColors("default");
Expand Down
3 changes: 2 additions & 1 deletion Shell/Themes/ThemeLoader.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text.Json;
using System.Text.Json.Nodes;

namespace NihilistShell.Shell.Themes
namespace NShell.Shell.Themes
{
/// <summary>
/// Enum representing the available default themes.
Expand Down
30 changes: 15 additions & 15 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ if ! command -v dotnet &> /dev/null; then
fi

USER_PROFILE=$(eval echo ~$USER)
NIHILIST_SHELL_DIR="$USER_PROFILE/.nihilist_shell"
HISTORY_FILE="$NIHILIST_SHELL_DIR/.nihilistshell_history"
NIHILIST_SHELL_DIR="$USER_PROFILE/.nshell"
HISTORY_FILE="$NIHILIST_SHELL_DIR/.nhistory"
THEMES_DIR="$NIHILIST_SHELL_DIR/themes"
PLUGINS_DIR="$NIHILIST_SHELL_DIR/plugins"

Expand All @@ -43,8 +43,8 @@ echo " - $THEMES_DIR"
echo " - $PLUGINS_DIR"
echo " - $HISTORY_FILE"

echo "[*] - Compiling NihilistShell..."
dotnet publish NihilistShell.csproj \
echo "[*] - Compiling NShell..."
dotnet publish NShell.csproj \
-c Release \
-r linux-x64 \
--self-contained true \
Expand All @@ -53,7 +53,7 @@ dotnet publish NihilistShell.csproj \
/p:IncludeNativeLibrariesForSelfExtract=true \
-o ./publish

BINARY="./publish/NihilistShell"
BINARY="./publish/NShell"

if [ ! -f "$BINARY" ]; then
echo "[-] - Build failed or binary not found at $BINARY"
Expand All @@ -63,17 +63,17 @@ fi
echo "[*] - Applying executable permissions..."
chmod +x "$BINARY"

echo "[*] - Copying to /usr/local/bin/ as 'nihilistshell'..."
sudo cp "$BINARY" /usr/local/bin/nihilistshell
echo "[*] - Copying to /usr/local/bin/ as 'nshell'..."
sudo cp "$BINARY" /usr/local/bin/nshell

echo "[*] - Adding /usr/local/bin/nihilistshell to /etc/shells if not already present..."
if ! grep -qx "/usr/local/bin/nihilistshell" /etc/shells; then
echo "/usr/local/bin/nihilistshell" | sudo tee -a /etc/shells > /dev/null
echo "[+] - Added NihilistShell to /etc/shells."
echo "[*] - Adding /usr/local/bin/nshell to /etc/shells if not already present..."
if ! grep -qx "/usr/local/bin/nshell" /etc/shells; then
echo "/usr/local/bin/nshell" | sudo tee -a /etc/shells > /dev/null
echo "[+] - Added NShell to /etc/shells."
fi

echo "[*] - Setting NihilistShell as the default shell for user $USER..."
chsh -s /usr/local/bin/nihilistshell
export SHELL=/usr/local/bin/nihilistshell
echo "[*] - Setting NShell as the default shell for user $USER..."
chsh -s /usr/local/bin/nshell
export SHELL=/usr/local/bin/nshell

echo "[+] - Installation complete. Restart your session or run: nihilistshell"
echo "[+] - Installation complete. Restart your session or run: nshell"
6 changes: 3 additions & 3 deletions uninstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

set -e

echo "[*] - Uninstalling NihilistShell..."
echo "[*] - Uninstalling NShell..."

echo "[*] - Setting default shell back to /bin/bash..."
chsh -s /bin/bash || {
echo "[-] - Failed to change default shell."
exit 1
}

BIN_PATH="/usr/local/bin/nihilistshell"
BIN_PATH="/usr/local/bin/nshell"

if [ -f "$BIN_PATH" ]; then
echo "[*] - Removing $BIN_PATH..."
Expand All @@ -32,5 +32,5 @@ if [[ "$confirm" =~ ^[Yy]$ ]]; then
echo "[+] - ./publish folder deleted."
fi

echo "[+] - NihilistShell has been fully uninstalled."
echo "[+] - NShell has been fully uninstalled."
echo "[*] - Restart your terminal to return to bash."
Loading