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

Development #459

Merged
merged 36 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
63e844d
Arguments: Extended to parse multiple and JSON loading support
webmaster442 Apr 13, 2024
344164c
More robust Git Parser
webmaster442 Apr 14, 2024
d7f017b
More robust Git Parser
webmaster442 Apr 14, 2024
88d0d22
Rendering fixes
webmaster442 Apr 16, 2024
cf16c69
md2html bugfix
webmaster442 Apr 20, 2024
19b6fde
Updates dependencies
webmaster442 Apr 23, 2024
157f73a
Updates changelog
webmaster442 Apr 23, 2024
e10ffd8
Git parser fix
webmaster442 Apr 29, 2024
2f3c2b0
Refactor: prepare for git gui command
webmaster442 Apr 29, 2024
37e3513
Basics of git GUI
webmaster442 Apr 29, 2024
9d0975c
Merge remote-tracking branch 'origin/master' into development
webmaster442 Apr 30, 2024
94f82e5
Git Gui progress
webmaster442 Apr 30, 2024
07dcf48
Git Gui: Checkout command
webmaster442 May 4, 2024
3f44ab8
Command runner: Added UTF8 config
webmaster442 May 4, 2024
d3a1752
Command runner: Change JSON parsing format
webmaster442 May 4, 2024
56960f6
Command runner: Change JSON parsing format
webmaster442 May 4, 2024
c6e5c1c
Git commit command in gui
webmaster442 May 8, 2024
a5670c4
FolderLock rework
webmaster442 May 9, 2024
b0f3730
Folder lock now uses mutex
webmaster442 May 11, 2024
6dcc7eb
Git gui command removed
webmaster442 May 11, 2024
7f58f94
MD2HTML changes
webmaster442 May 17, 2024
4e870a6
Fixes failing tests
webmaster442 May 18, 2024
e732f8e
Organizer initial version
webmaster442 May 19, 2024
f771bde
Organize bugfixes
webmaster442 May 20, 2024
4709c4a
Git AutoComplete for bookgen shell
webmaster442 May 20, 2024
c4cd8d2
Reworked arguments from json working
webmaster442 May 22, 2024
9d95815
WIP: Basics of new unified & lightweight template engine
webmaster442 May 30, 2024
26359d0
Work on new render engine
webmaster442 Jun 1, 2024
915170a
Render engine: Make it default, Step 1.
webmaster442 Jun 1, 2024
72421ca
Render engine: Make it default, Step 2.
webmaster442 Jun 1, 2024
d3e154f
Render engine: Make it default, Step 3.
webmaster442 Jun 2, 2024
4bb360e
Template update
webmaster442 Jun 2, 2024
62438aa
Test fixes
webmaster442 Jun 2, 2024
6aa150a
Nuget package update
webmaster442 Jun 3, 2024
9955462
Iso now contains Powershell core as a bundle
webmaster442 Jun 3, 2024
348d342
06.04 pre release code
webmaster442 Jun 4, 2024
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
21 changes: 7 additions & 14 deletions BookGen.sln
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BookGen.Contents", "Libs\Bo
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BookGen.Cli", "Libs\BookGen.Cli\BookGen.Cli.csproj", "{859C300C-33B4-4F24-8A6C-F430520774DB}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BookGen.Native", "Libs\BookGen.Native\BookGen.Native.csproj", "{8A1FEF90-2B8F-4849-B7C9-63EDE7F120E0}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BookGen.ShortCodes", "Libs\BookGen.ShortCodes\BookGen.ShortCodes.csproj", "{079B77CD-3380-4947-BDE8-E0E774FD8E6F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BookGen.Shell", "Prog\BookGen.Shell\BookGen.Shell.csproj", "{985728E4-6353-44A1-87BB-77BF366A5977}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BookGen.Settings", "Libs\BookGen.Settings\BookGen.Settings.csproj", "{B1905B26-0649-4911-BA5F-9781BBC3D3E2}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BookGen.RenderEngine", "Libs\BookGen.RenderEngine\BookGen.RenderEngine.csproj", "{4E7C4D96-32DD-4E72-8B28-F4DCDB74E177}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -128,14 +126,6 @@ Global
{859C300C-33B4-4F24-8A6C-F430520774DB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{859C300C-33B4-4F24-8A6C-F430520774DB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{859C300C-33B4-4F24-8A6C-F430520774DB}.Release|Any CPU.Build.0 = Release|Any CPU
{8A1FEF90-2B8F-4849-B7C9-63EDE7F120E0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8A1FEF90-2B8F-4849-B7C9-63EDE7F120E0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8A1FEF90-2B8F-4849-B7C9-63EDE7F120E0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8A1FEF90-2B8F-4849-B7C9-63EDE7F120E0}.Release|Any CPU.Build.0 = Release|Any CPU
{079B77CD-3380-4947-BDE8-E0E774FD8E6F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{079B77CD-3380-4947-BDE8-E0E774FD8E6F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{079B77CD-3380-4947-BDE8-E0E774FD8E6F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{079B77CD-3380-4947-BDE8-E0E774FD8E6F}.Release|Any CPU.Build.0 = Release|Any CPU
{985728E4-6353-44A1-87BB-77BF366A5977}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{985728E4-6353-44A1-87BB-77BF366A5977}.Debug|Any CPU.Build.0 = Debug|Any CPU
{985728E4-6353-44A1-87BB-77BF366A5977}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand All @@ -144,6 +134,10 @@ Global
{B1905B26-0649-4911-BA5F-9781BBC3D3E2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B1905B26-0649-4911-BA5F-9781BBC3D3E2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B1905B26-0649-4911-BA5F-9781BBC3D3E2}.Release|Any CPU.Build.0 = Release|Any CPU
{4E7C4D96-32DD-4E72-8B28-F4DCDB74E177}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4E7C4D96-32DD-4E72-8B28-F4DCDB74E177}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4E7C4D96-32DD-4E72-8B28-F4DCDB74E177}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4E7C4D96-32DD-4E72-8B28-F4DCDB74E177}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -164,10 +158,9 @@ Global
{596AE4F8-A8C8-4B0E-8285-605E30498AFA} = {9C47BBFF-ACD8-40D8-9FB1-A3FA524B27C4}
{8166DFAD-9B7A-4CCE-BE8B-577AC52D5066} = {9C47BBFF-ACD8-40D8-9FB1-A3FA524B27C4}
{859C300C-33B4-4F24-8A6C-F430520774DB} = {9C47BBFF-ACD8-40D8-9FB1-A3FA524B27C4}
{8A1FEF90-2B8F-4849-B7C9-63EDE7F120E0} = {9C47BBFF-ACD8-40D8-9FB1-A3FA524B27C4}
{079B77CD-3380-4947-BDE8-E0E774FD8E6F} = {9C47BBFF-ACD8-40D8-9FB1-A3FA524B27C4}
{985728E4-6353-44A1-87BB-77BF366A5977} = {05B69A0E-343B-4E7C-B77B-24E84B57D5D2}
{B1905B26-0649-4911-BA5F-9781BBC3D3E2} = {9C47BBFF-ACD8-40D8-9FB1-A3FA524B27C4}
{4E7C4D96-32DD-4E72-8B28-F4DCDB74E177} = {9C47BBFF-ACD8-40D8-9FB1-A3FA524B27C4}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {772515BA-79D4-4C5D-AF16-29DE649EC13E}
Expand Down
26 changes: 24 additions & 2 deletions BookGenShell.ps1
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -----------------------------------------------------------------------------
# BookGen PowerShell Registration script
# Version 2.7.0
# Last modified: 2023-12-07
# Version 2.9.0
# Last modified: 2024-05-20
# -----------------------------------------------------------------------------

# cdg command
Expand Down Expand Up @@ -34,6 +34,20 @@ function www
}
}

# organize command
function organize
{
$argsAsString = $args -join ' '
if ([string]::IsNullOrWhiteSpace($argsAsString))
{
BookGen.Shell.exe "organize"
}
else
{
BookGen.Shell.exe "organize" "$argsAsString"
}
}

# info command
function bookgen-info()
{
Expand Down Expand Up @@ -116,6 +130,14 @@ Register-ArgumentCompleter -Native -CommandName dotnet -ScriptBlock {
}
}

# PowerShell parameter completion shim for git
Register-ArgumentCompleter -Native -CommandName git -ScriptBlock {
param($commandName, $wordToComplete, $cursorPosition)
BookGen.Shell.exe "git-complete" $cursorPosition "$wordToComplete" | ForEach-Object {
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)
}
}

# set prompt
function prompt {
$git = $(BookGen.Shell.exe "prompt" $(Get-Location).Path)
Expand Down
9 changes: 7 additions & 2 deletions Bootstrappers/BookGen/Program.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//-----------------------------------------------------------------------------
// (c) 2023 Ruzsinszki Gábor
// (c) 2023-2024 Ruzsinszki Gábor
// This code is licensed under MIT license (see LICENSE for details)
//-----------------------------------------------------------------------------

Expand All @@ -19,9 +19,14 @@ public static class Program
public static void Main()
{
string shellExe = InstallDetector.IsInstalled(Constants.PowershellCore)
? Constants.PowershellCore
? Constants.PowershellCore
: Constants.Powershell;

if (InstallDetector.IsPowershellLocallyPresent(out string pwshPath))
{
shellExe = pwshPath;
}

string shellScript = Path.Combine(AppContext.BaseDirectory, Constants.DataFolder, "BookGenShell.ps1");

ExceptionHandler.Try(() =>
Expand Down
3 changes: 2 additions & 1 deletion Bootstrappers/Bookgen.Win/Constants.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//-----------------------------------------------------------------------------
// (c) 2023 Ruzsinszki Gábor
// (c) 2023-2024 Ruzsinszki Gábor
// This code is licensed under MIT license (see LICENSE for details)
//-----------------------------------------------------------------------------

Expand All @@ -13,5 +13,6 @@ public static class Constants
public const string WindowsTerminal = "wt.exe";
public const string PowershellCore = "pwsh.exe";
public const string Powershell = "powershell.exe";
public const string PowerShellFolder = "powershell";
}
}
6 changes: 6 additions & 0 deletions Bootstrappers/Bookgen.Win/InstallDetector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,11 @@ public static bool IsInstalled(string programName)
}
return false;
}

public static bool IsPowershellLocallyPresent(out string pwshPath)
{
pwshPath = Path.Combine(AppContext.BaseDirectory, Constants.PowerShellFolder, Constants.PowershellCore);
return File.Exists(pwshPath);
}
}
}
9 changes: 7 additions & 2 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
# Next
# 2024. 06. 04 (Pre release)

* New: Added autocomplete in bookgen shell for basic git commands
* New: ISO build now includes powershell core
* New: Added table of contents support via the [toc] tag in markdown
* New: JSON array support for subcommand configuration.
* Change: Updated dependencies
* Change: Cplipboard implementation replaced with TextCopy
* Change: Cplipboard implementation replaced with TextCopy, now works multiplatform
* Change: Linux distribution now uses a deb package for distribution
* Change: SVG Passthrough implemented in md2html command
* Change: md2thml is extended with templating and new options
* Change: Various BookGen related settings now use a single .ZIP file for configuration
* Change: Reworked templating engine
* Fix: Various linux compatibility fixes
* Fix: Various fixes in the Table of Contents generation
* Fix: Template processor fixes
Expand Down
26 changes: 21 additions & 5 deletions Commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,27 @@ Initializes a folder as BookGen project

Arguments:

-d, --dir:
Optional argument. Specifies work directory. If not specified, then
the current directory will be used as working directory.

# JsonArgs

Creates an empty json arguments template file for a given bookgen command.

`BookGen JsonArgs -c [command] {-d [directory]}`
`BookGen JsonArgs --command [command] {--dir [directory]}`

A Json arguments template can be used to store command line arguments,
so the bookgen command can be invoked with the same arguments without having
to type them in again.

Arguments:

-c, --command:
Required argument. Specifies the command for which the json template
will be created.

-d, --dir:
Optional argument. Specifies work directory. If not specified, then
the current directory will be used as working directory.
Expand Down Expand Up @@ -403,11 +424,6 @@ Arguments:
-i, --input:
Input markdown file path

# Shortcodes

Displays the available shortcode names that can be used in markdown and
template files.

# Tags

Create or update the tags database and display various stats
Expand Down
22 changes: 0 additions & 22 deletions Libs/BookGen.Api/ArgumentInfo.cs

This file was deleted.

48 changes: 0 additions & 48 deletions Libs/BookGen.Api/IArguments.cs

This file was deleted.

35 changes: 0 additions & 35 deletions Libs/BookGen.Api/ITemplateShortCode.cs

This file was deleted.

26 changes: 0 additions & 26 deletions Libs/BookGen.Api/ShortCodeInfo.cs

This file was deleted.

7 changes: 7 additions & 0 deletions Libs/BookGen.Cli/ArgumentJsonItem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace BookGen.Cli;

public sealed class ArgumentJsonItem
{
public required string Name { get; init; }
public required string[] Arguments { get; init; }
}
21 changes: 21 additions & 0 deletions Libs/BookGen.Cli/ArgumentParsing/ArgumentBag.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,27 @@ public bool GetSwitch(SwitchAttribute @switch)
return null;
}

public string[] GetSwitchValues(SwitchAttribute @switch)
{
List<string> values = new();
for (int i = 0; i < _arguments.Length; i++)
{
if (_arguments[i] == $"-{@switch.ShortName}"
|| _arguments[i] == $"--{@switch.LongName}")
{
int nextIndex = i + 1;
if (nextIndex < _arguments.Length)
{
string? returnValue = _arguments[nextIndex];
_arguments[i] = null;
_arguments[nextIndex] = null;
values.Add(returnValue ?? string.Empty);
}
}
}
return values.ToArray();
}

public string? GetArgument(ArgumentAttribute argument)
{
int notNullIndex = -1;
Expand Down
Loading
Loading