mirror of
https://github.com/AdisonCavani/distro-grub-themes.git
synced 2025-06-06 07:12:33 +02:00
Add verbose mode
This commit is contained in:
parent
2029db1737
commit
abf22444f9
4 changed files with 94 additions and 34 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -332,3 +332,4 @@ ASALocalRun/
|
||||||
|
|
||||||
# Local History for Visual Studio
|
# Local History for Visual Studio
|
||||||
.localhistory/
|
.localhistory/
|
||||||
|
src/Properties/launchSettings.json
|
||||||
|
|
|
@ -4,7 +4,7 @@ namespace DistroGrubThemes
|
||||||
{
|
{
|
||||||
public class ArchiveManager
|
public class ArchiveManager
|
||||||
{
|
{
|
||||||
public static void CreateTarArchive(string sourceDirectory, string outputFile)
|
public static void CreateTarArchive(string sourceDirectory, string outputFile, bool verbose)
|
||||||
{
|
{
|
||||||
Chilkat.Tar tar = new Chilkat.Tar
|
Chilkat.Tar tar = new Chilkat.Tar
|
||||||
{
|
{
|
||||||
|
@ -35,9 +35,12 @@ namespace DistroGrubThemes
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Console.ForegroundColor = ConsoleColor.Green;
|
if (verbose)
|
||||||
Console.Write("OK\n");
|
{
|
||||||
Console.ResetColor();
|
Console.ForegroundColor = ConsoleColor.Green;
|
||||||
|
Console.Write("OK\n");
|
||||||
|
Console.ResetColor();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
103
src/Program.cs
103
src/Program.cs
|
@ -1,7 +1,6 @@
|
||||||
using CommandLine;
|
using CommandLine;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
|
@ -19,63 +18,111 @@ namespace DistroGrubThemes
|
||||||
static void RunOptions(ProgramOptions opts)
|
static void RunOptions(ProgramOptions opts)
|
||||||
{
|
{
|
||||||
Program program = new Program();
|
Program program = new Program();
|
||||||
|
|
||||||
string path = program.CheckRepoPath(opts.RepositoryPath);
|
string path = program.CheckRepoPath(opts.RepositoryPath);
|
||||||
|
|
||||||
program.UpdateAssets(path);
|
if (opts.UpdateFonts)
|
||||||
Console.WriteLine();
|
{
|
||||||
program.UpdateArchive(path);
|
program.UpdateFonts(path + @"\font", path + @"\customize", opts.VerboseMode);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (opts.UpdateIcons)
|
||||||
|
{
|
||||||
|
if (opts.VerboseMode)
|
||||||
|
Console.WriteLine();
|
||||||
|
|
||||||
|
program.UpdateIcons(path + @"\assets\icons", path + @"\customize", opts.VerboseMode);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (opts.UpdateArchives)
|
||||||
|
{
|
||||||
|
if (opts.VerboseMode)
|
||||||
|
Console.WriteLine();
|
||||||
|
|
||||||
|
program.UpdateArchive(path, opts.VerboseMode);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateArchive(string path)
|
void UpdateArchive(string path, bool verbose)
|
||||||
{
|
{
|
||||||
|
if (!verbose)
|
||||||
|
Console.Write("Creating .tar archives ... ");
|
||||||
|
|
||||||
foreach (var directory in DirectoriesDictionary(path + @"\customize", path))
|
foreach (var directory in DirectoriesDictionary(path + @"\customize", path))
|
||||||
{
|
{
|
||||||
Console.Write("Creating " + directory.Value + ".tar archive ... ");
|
if (verbose)
|
||||||
ArchiveManager.CreateTarArchive(directory.Key, path + @"\themes\" + directory.Value + ".tar");
|
Console.Write("Creating " + directory.Value + ".tar archive ... ");
|
||||||
|
|
||||||
|
ArchiveManager.CreateTarArchive(directory.Key, path + @"\themes\" + directory.Value + ".tar", verbose);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!verbose)
|
||||||
|
{
|
||||||
|
Console.ForegroundColor = ConsoleColor.Green;
|
||||||
|
Console.Write("OK\n");
|
||||||
|
Console.ResetColor();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateAssets(string path)
|
void UpdateIcons(string iconsPath, string customizePath, bool verbose)
|
||||||
{
|
{
|
||||||
UpdateIcons(path + @"\assets\icons", path + @"\customize");
|
if (!verbose)
|
||||||
UpdateFonts(path + @"\font", path + @"\customize");
|
Console.Write("Copying icons ... ");
|
||||||
}
|
|
||||||
|
|
||||||
void UpdateIcons(string iconsPath, string customizePath)
|
|
||||||
{
|
|
||||||
Console.Write("\nUpdating icons ... ");
|
|
||||||
var icons = FilesArray(iconsPath);
|
|
||||||
|
|
||||||
foreach (var directory in DirectoriesArray(customizePath))
|
foreach (var directory in DirectoriesArray(customizePath))
|
||||||
{
|
{
|
||||||
foreach (var icon in icons)
|
foreach (var icon in FilesArray(iconsPath))
|
||||||
{
|
{
|
||||||
|
if (verbose)
|
||||||
|
Console.Write("Copying " + icon + " ... ");
|
||||||
|
|
||||||
File.Copy(iconsPath + @"\" + icon, directory + @"\icons\" + icon, true);
|
File.Copy(iconsPath + @"\" + icon, directory + @"\icons\" + icon, true);
|
||||||
|
|
||||||
|
if (verbose)
|
||||||
|
{
|
||||||
|
Console.ForegroundColor = ConsoleColor.Green;
|
||||||
|
Console.Write("OK\n");
|
||||||
|
Console.ResetColor();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Console.ForegroundColor = ConsoleColor.Green;
|
if (!verbose)
|
||||||
Console.Write("OK\n");
|
{
|
||||||
Console.ResetColor();
|
Console.ForegroundColor = ConsoleColor.Green;
|
||||||
|
Console.Write("OK\n");
|
||||||
|
Console.ResetColor();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateFonts(string fontsPath, string customizePath)
|
void UpdateFonts(string fontsPath, string customizePath, bool verbose)
|
||||||
{
|
{
|
||||||
Console.Write("Updating fonts ... ");
|
if (!verbose)
|
||||||
var fonts = FilesArray(fontsPath);
|
Console.Write("Copying fonts ... ");
|
||||||
|
|
||||||
foreach (var directory in DirectoriesArray(customizePath))
|
foreach (var directory in DirectoriesArray(customizePath))
|
||||||
{
|
{
|
||||||
foreach (var font in fonts)
|
foreach (var font in FilesArray(fontsPath))
|
||||||
{
|
{
|
||||||
|
if (verbose)
|
||||||
|
Console.Write("Copying " + font + " ... ");
|
||||||
|
|
||||||
File.Copy(fontsPath + @"\" + font, directory + @"\" + font, true);
|
File.Copy(fontsPath + @"\" + font, directory + @"\" + font, true);
|
||||||
|
|
||||||
|
if (verbose)
|
||||||
|
{
|
||||||
|
Console.ForegroundColor = ConsoleColor.Green;
|
||||||
|
Console.Write("OK\n");
|
||||||
|
Console.ResetColor();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Console.ForegroundColor = ConsoleColor.Green;
|
if (!verbose)
|
||||||
Console.Write("OK\n");
|
{
|
||||||
Console.ResetColor();
|
Console.ForegroundColor = ConsoleColor.Green;
|
||||||
|
Console.Write("OK\n");
|
||||||
|
Console.ResetColor();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List<string> FilesArray(string folderPath)
|
List<string> FilesArray(string folderPath)
|
||||||
|
|
|
@ -7,7 +7,16 @@ namespace DistroGrubThemes
|
||||||
[Option('r', "repository", Required = true, HelpText = "Path to repository.")]
|
[Option('r', "repository", Required = true, HelpText = "Path to repository.")]
|
||||||
public string RepositoryPath { get; set; }
|
public string RepositoryPath { get; set; }
|
||||||
|
|
||||||
[Option('a', "archive", HelpText = "Create theme archive.")]
|
[Option('a', "archive", HelpText = "Update archives.")]
|
||||||
public string ArchivedFiles { get; set; }
|
public bool UpdateArchives { get; set; }
|
||||||
|
|
||||||
|
[Option('f', "fonts", HelpText = "Update fonts.")]
|
||||||
|
public bool UpdateFonts { get; set; }
|
||||||
|
|
||||||
|
[Option('i', "icons", HelpText = "Update icons.")]
|
||||||
|
public bool UpdateIcons { get; set; }
|
||||||
|
|
||||||
|
[Option('v', "verbose" , HelpText = "Enable debug messages.")]
|
||||||
|
public bool VerboseMode { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue