├── assets ├── Icon.png └── Icon.svg ├── src └── Boxer │ ├── Boxer │ ├── Handlers │ │ ├── IRequest.cs │ │ ├── IHandler.cs │ │ └── Sandbox │ │ │ ├── SandboxRequest.cs │ │ │ └── SandboxHandler.cs │ ├── Args │ │ ├── ScriptArgs │ │ │ ├── IScriptArg.cs │ │ │ ├── LiteralScriptArg.cs │ │ │ ├── ScoopScriptArg.cs │ │ │ ├── FileScriptArg.cs │ │ │ ├── ChocolateyScriptArg.cs │ │ │ └── Parsers │ │ │ │ ├── LiteralScriptArgParser.cs │ │ │ │ ├── ScoopScriptArgsParser.cs │ │ │ │ ├── ChocolateyArgParser.cs │ │ │ │ └── FileScriptArgParser.cs │ │ ├── ConfigArgs │ │ │ ├── IConfigArg.cs │ │ │ ├── FileArg.cs │ │ │ └── Parsers │ │ │ │ └── FileArgParser.cs │ │ ├── IVerb.cs │ │ ├── Factories │ │ │ ├── IArgParserFactory.cs │ │ │ ├── IVerbParserFactory.cs │ │ │ ├── VerbParserFactory.cs │ │ │ └── ArgParserFactory.cs │ │ ├── IArg.cs │ │ ├── IArgParser.cs │ │ ├── IVerbParser.cs │ │ ├── Verbs │ │ │ ├── HelpVerb.cs │ │ │ ├── ScriptVerb.cs │ │ │ ├── ConfigVerb.cs │ │ │ ├── VersionVerb.cs │ │ │ └── Parsers │ │ │ │ ├── HelpVerbParser.cs │ │ │ │ ├── VersionVerbParser.cs │ │ │ │ ├── ScriptVerbParser.cs │ │ │ │ └── ConfigVerbParser.cs │ │ └── SharedArgs │ │ │ ├── HelpArg.cs │ │ │ └── Parsers │ │ │ └── HelpArgParser.cs │ ├── Parser │ │ ├── ICommandLineArgsParser.cs │ │ └── CommandLineArgsParser.cs │ ├── Exceptions │ │ ├── ArgNotFoundException.cs │ │ ├── ParamNotFoundException.cs │ │ ├── VerbNotFoundException.cs │ │ └── NotSupportedFileTypeException.cs │ ├── Models │ │ └── Configuration.cs │ ├── Utils │ │ └── TranslatorUtils.cs │ ├── Program.cs │ ├── Boxer.csproj │ └── DIC │ │ └── DependendencyResolver.cs │ └── Boxer.sln ├── LICENSE.md ├── README.md └── .gitignore /assets/Icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hasan-hasanov/Boxer/HEAD/assets/Icon.png -------------------------------------------------------------------------------- /src/Boxer/Boxer/Handlers/IRequest.cs: -------------------------------------------------------------------------------- 1 | namespace Boxer.Handlers 2 | { 3 | public interface IRequest { } 4 | } 5 | -------------------------------------------------------------------------------- /src/Boxer/Boxer/Args/ScriptArgs/IScriptArg.cs: -------------------------------------------------------------------------------- 1 | namespace Boxer.Args.ScriptArgs 2 | { 3 | public interface IScriptArg : IArg { } 4 | } 5 | -------------------------------------------------------------------------------- /src/Boxer/Boxer/Args/ConfigArgs/IConfigArg.cs: -------------------------------------------------------------------------------- 1 | namespace Boxer.Args.ConfigArgs 2 | { 3 | public interface IConfigArg : IArg 4 | { 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /src/Boxer/Boxer/Args/IVerb.cs: -------------------------------------------------------------------------------- 1 | namespace Boxer.Args 2 | { 3 | public interface IVerb 4 | { 5 | string[] Name { get; } 6 | 7 | string Help { get; } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/Boxer/Boxer/Args/Factories/IArgParserFactory.cs: -------------------------------------------------------------------------------- 1 | namespace Boxer.Args.Factories 2 | { 3 | public interface IArgParserFactory 4 | { 5 | IArgParser this[string key] { get; } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/Boxer/Boxer/Args/Factories/IVerbParserFactory.cs: -------------------------------------------------------------------------------- 1 | namespace Boxer.Args.Factories 2 | { 3 | public interface IVerbParserFactory 4 | { 5 | IVerbParser this[string key] { get; } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/Boxer/Boxer/Parser/ICommandLineArgsParser.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | 3 | namespace Boxer.Parser 4 | { 5 | public interface ICommandLineArgsParser 6 | { 7 | Task Parse(string[] args); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/Boxer/Boxer/Args/IArg.cs: -------------------------------------------------------------------------------- 1 | namespace Boxer.Args 2 | { 3 | public interface IArg 4 | { 5 | string ShortName { get; } 6 | 7 | string LongName { get; } 8 | 9 | string Help { get; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Boxer/Boxer/Args/IArgParser.cs: -------------------------------------------------------------------------------- 1 | using ScoopBox.Scripts; 2 | using System.Collections.Generic; 3 | 4 | namespace Boxer.Args 5 | { 6 | public interface IArgParser 7 | { 8 | List Parse(string arg); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/Boxer/Boxer/Args/IVerbParser.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Threading.Tasks; 3 | 4 | namespace Boxer.Args 5 | { 6 | public interface IVerbParser 7 | { 8 | Task Parse(Stack args); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/Boxer/Boxer/Exceptions/ArgNotFoundException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Boxer.Exceptions 4 | { 5 | public class ArgNotFoundException : Exception 6 | { 7 | public ArgNotFoundException(string message) : base(message) 8 | { 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Boxer/Boxer/Exceptions/ParamNotFoundException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Boxer.Exceptions 4 | { 5 | public class ParamNotFoundException : Exception 6 | { 7 | public ParamNotFoundException(string message) : base(message) 8 | { 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Boxer/Boxer/Exceptions/VerbNotFoundException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Boxer.Exceptions 4 | { 5 | public class VerbNotFoundException : Exception 6 | { 7 | public VerbNotFoundException(string message) : base(message) 8 | { 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Boxer/Boxer/Exceptions/NotSupportedFileTypeException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Boxer.Exceptions 4 | { 5 | public class NotSupportedFileTypeException : Exception 6 | { 7 | public NotSupportedFileTypeException(string message) 8 | : base(message) 9 | { 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/Boxer/Boxer/Handlers/IHandler.cs: -------------------------------------------------------------------------------- 1 | using System.Threading; 2 | using System.Threading.Tasks; 3 | 4 | namespace Boxer.Handlers 5 | { 6 | public interface IHandler 7 | where TRequest : IRequest 8 | { 9 | Task HandleAsync(TRequest command, CancellationToken cancellationToken = default); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Boxer/Boxer/Args/Verbs/HelpVerb.cs: -------------------------------------------------------------------------------- 1 | namespace Boxer.Args.Verbs 2 | { 3 | public class HelpVerb : IVerb 4 | { 5 | public HelpVerb() 6 | { 7 | Name = new[] { "help", "--help", "-h" }; 8 | } 9 | 10 | public string[] Name { get; } 11 | 12 | public string Help { get; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Boxer/Boxer/Models/Configuration.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace Boxer.Models 4 | { 5 | public class Configuration 6 | { 7 | [JsonPropertyName("args")] 8 | public string[] Args { get; set; } 9 | 10 | [JsonPropertyName("type")] 11 | public string Type { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/Boxer/Boxer/Handlers/Sandbox/SandboxRequest.cs: -------------------------------------------------------------------------------- 1 | using ScoopBox.Scripts; 2 | using System.Collections.Generic; 3 | 4 | namespace Boxer.Handlers.Sandbox 5 | { 6 | public class SandboxRequest : IRequest 7 | { 8 | public SandboxRequest(List scripts) 9 | { 10 | Scripts = scripts; 11 | } 12 | 13 | public List Scripts { get; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Boxer/Boxer/Args/SharedArgs/HelpArg.cs: -------------------------------------------------------------------------------- 1 | namespace Boxer.Args.SharedArgs 2 | { 3 | public class HelpArg : IArg 4 | { 5 | public HelpArg() 6 | { 7 | ShortName = "-h"; 8 | LongName = "--help"; 9 | } 10 | 11 | public string ShortName { get; } 12 | 13 | public string LongName { get; } 14 | 15 | public string Help { get; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Boxer/Boxer/Args/Verbs/ScriptVerb.cs: -------------------------------------------------------------------------------- 1 | namespace Boxer.Args.Verbs 2 | { 3 | public class ScriptVerb : IVerb 4 | { 5 | public ScriptVerb() 6 | { 7 | Name = new[] { "script" }; 8 | Help = "Executes scripts and installs aplications in sandbox."; 9 | } 10 | 11 | public string[] Name { get; } 12 | 13 | public string Help { get; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Boxer/Boxer/Args/Verbs/ConfigVerb.cs: -------------------------------------------------------------------------------- 1 | namespace Boxer.Args.Verbs 2 | { 3 | public class ConfigVerb : IVerb 4 | { 5 | public ConfigVerb() 6 | { 7 | Name = new[] { "config" }; 8 | 9 | // TODO: Improve help 10 | Help = "Use this for configuration"; 11 | } 12 | 13 | public string[] Name { get; } 14 | 15 | public string Help { get; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Boxer/Boxer/Args/Verbs/VersionVerb.cs: -------------------------------------------------------------------------------- 1 | namespace Boxer.Args.Verbs 2 | { 3 | public class VersionVerb : IVerb 4 | { 5 | public VersionVerb() 6 | { 7 | Name = new string[] { "version", "--version", "-v" }; 8 | Help = "Displays the version of the project in the format: MAJOR.MINOR.BUILD.REVISION"; 9 | } 10 | 11 | public string[] Name { get; } 12 | 13 | public string Help { get; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Boxer/Boxer/Args/ConfigArgs/FileArg.cs: -------------------------------------------------------------------------------- 1 | namespace Boxer.Args.ConfigArgs 2 | { 3 | public class FileArg : IConfigArg 4 | { 5 | public FileArg() 6 | { 7 | ShortName = "-f"; 8 | LongName = "--file"; 9 | 10 | Help = "Path to the config file."; 11 | } 12 | 13 | public string ShortName { get; } 14 | 15 | public string LongName { get; } 16 | 17 | public string Help { get; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Boxer/Boxer/Args/ScriptArgs/LiteralScriptArg.cs: -------------------------------------------------------------------------------- 1 | namespace Boxer.Args.ScriptArgs 2 | { 3 | public class LiteralScriptArg : IScriptArg 4 | { 5 | public LiteralScriptArg() 6 | { 7 | ShortName = "-s"; 8 | LongName = "--literal-script"; 9 | Help = "Single powershell command."; 10 | } 11 | 12 | public string ShortName { get; } 13 | 14 | public string LongName { get; } 15 | 16 | public string Help { get; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Boxer/Boxer/Args/ScriptArgs/ScoopScriptArg.cs: -------------------------------------------------------------------------------- 1 | namespace Boxer.Args.ScriptArgs 2 | { 3 | public class ScoopScriptArg : IScriptArg 4 | { 5 | public ScoopScriptArg() 6 | { 7 | LongName = "--scoop"; 8 | Help = "Applications that will be installed with Scoop, should be separated by comma (,)."; 9 | } 10 | 11 | public string ShortName { get; } 12 | 13 | public string LongName { get; } 14 | 15 | public string Help { get; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Boxer/Boxer/Args/ScriptArgs/FileScriptArg.cs: -------------------------------------------------------------------------------- 1 | namespace Boxer.Args.ScriptArgs 2 | { 3 | public class FileScriptArg : IScriptArg 4 | { 5 | public FileScriptArg() 6 | { 7 | ShortName = "-f"; 8 | LongName = "--file-script"; 9 | Help = "Full path of the script file including the extension."; 10 | } 11 | 12 | public string ShortName { get; } 13 | 14 | public string LongName { get; } 15 | 16 | public string Help { get; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Boxer/Boxer/Args/ScriptArgs/ChocolateyScriptArg.cs: -------------------------------------------------------------------------------- 1 | namespace Boxer.Args.ScriptArgs 2 | { 3 | public class ChocolateyScriptArg : IScriptArg 4 | { 5 | public ChocolateyScriptArg() 6 | { 7 | LongName = "--chocolatey"; 8 | Help = "Applications that will be installed with Chocolatey, should be separated by comma (,)."; 9 | } 10 | 11 | public string ShortName { get; } 12 | 13 | public string LongName { get; } 14 | 15 | public string Help { get; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Boxer/Boxer/Args/Factories/VerbParserFactory.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | 4 | namespace Boxer.Args.Factories 5 | { 6 | public class VerbParserFactory : Dictionary, IVerbParserFactory 7 | { 8 | public IVerbParser this[string key] 9 | { 10 | get 11 | { 12 | var dictionaryKey = Keys.FirstOrDefault(k => k.Name.Contains(key)); 13 | return dictionaryKey == null ? null : base[dictionaryKey]; 14 | } 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Boxer/Boxer/Args/ScriptArgs/Parsers/LiteralScriptArgParser.cs: -------------------------------------------------------------------------------- 1 | using ScoopBox.Scripts; 2 | using ScoopBox.Scripts.UnMaterialized; 3 | using System; 4 | using System.Collections.Generic; 5 | 6 | namespace Boxer.Args.ScriptArgs.Parsers 7 | { 8 | public class LiteralScriptArgParser : IArgParser 9 | { 10 | public List Parse(string arg) 11 | { 12 | string[] scripts = arg.Split(";", StringSplitOptions.RemoveEmptyEntries); 13 | return new List() { new LiteralScript(scripts) }; 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Boxer/Boxer/Args/Factories/ArgParserFactory.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | 4 | namespace Boxer.Args.Factories 5 | { 6 | public class ArgParserFactory : Dictionary, IArgParserFactory 7 | { 8 | public IArgParser this[string key] 9 | { 10 | get 11 | { 12 | var dictionaryKey = Keys.FirstOrDefault(k => k.LongName == key || k.ShortName == key); 13 | return dictionaryKey == null ? null : base[dictionaryKey]; 14 | } 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Boxer/Boxer/Args/ScriptArgs/Parsers/ScoopScriptArgsParser.cs: -------------------------------------------------------------------------------- 1 | using ScoopBox.Scripts; 2 | using ScoopBox.Scripts.PackageManagers.Scoop; 3 | using System; 4 | using System.Collections.Generic; 5 | 6 | namespace Boxer.Args.ScriptArgs.Parsers 7 | { 8 | public class ScoopScriptArgsParser : IArgParser 9 | { 10 | public List Parse(string arg) 11 | { 12 | string[] scoopApps = arg.Split(",", StringSplitOptions.RemoveEmptyEntries); 13 | return new List() { new ScoopPackageManagerScript(scoopApps) }; 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Boxer/Boxer/Args/ScriptArgs/Parsers/ChocolateyArgParser.cs: -------------------------------------------------------------------------------- 1 | using ScoopBox.Scripts; 2 | using ScoopBox.Scripts.PackageManagers.Chocolatey; 3 | using System; 4 | using System.Collections.Generic; 5 | 6 | namespace Boxer.Args.ScriptArgs.Parsers 7 | { 8 | public class ChocolateyArgParser : IArgParser 9 | { 10 | public List Parse(string arg) 11 | { 12 | string[] chocoApps = arg.Split(",", StringSplitOptions.RemoveEmptyEntries); 13 | return new List() { new ChocolateyPackageManagerScript(chocoApps) }; 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Boxer/Boxer/Handlers/Sandbox/SandboxHandler.cs: -------------------------------------------------------------------------------- 1 | using ScoopBox; 2 | using System.Threading; 3 | using System.Threading.Tasks; 4 | 5 | namespace Boxer.Handlers.Sandbox 6 | { 7 | public class SandboxHandler : IHandler 8 | { 9 | private readonly ISandbox _sandbox; 10 | 11 | public SandboxHandler(ISandbox sandbox) 12 | { 13 | _sandbox = sandbox; 14 | } 15 | 16 | public async Task HandleAsync(SandboxRequest command, CancellationToken cancellationToken = default) 17 | { 18 | await _sandbox.Run(command.Scripts, cancellationToken); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Boxer/Boxer/Args/ScriptArgs/Parsers/FileScriptArgParser.cs: -------------------------------------------------------------------------------- 1 | using Boxer.Utils; 2 | using ScoopBox.Scripts; 3 | using ScoopBox.Scripts.Materialized; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.IO; 7 | using System.Linq; 8 | 9 | namespace Boxer.Args.ScriptArgs.Parsers 10 | { 11 | public class FileScriptArgParser : IArgParser 12 | { 13 | public List Parse(string arg) 14 | { 15 | List scripts = new List(); 16 | string[] filePaths = arg.Split(",", StringSplitOptions.RemoveEmptyEntries); 17 | 18 | List fileScripts = filePaths.Select(f => new ExternalScript(new FileInfo(f), TranslatorUtils.GetTranslatorByExtensionType(f))).ToList(); 19 | 20 | scripts.AddRange(fileScripts); 21 | return scripts; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Hasan Hasanov 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/Boxer/Boxer.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.30717.126 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Boxer", "Boxer\Boxer.csproj", "{77387E8B-EC59-48B3-92AD-D7C1D0798EAC}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {77387E8B-EC59-48B3-92AD-D7C1D0798EAC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {77387E8B-EC59-48B3-92AD-D7C1D0798EAC}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {77387E8B-EC59-48B3-92AD-D7C1D0798EAC}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {77387E8B-EC59-48B3-92AD-D7C1D0798EAC}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {9BCF1681-B73C-4173-93E4-64C2FFE35724} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /src/Boxer/Boxer/Utils/TranslatorUtils.cs: -------------------------------------------------------------------------------- 1 | using Boxer.Exceptions; 2 | using ScoopBox.Translators; 3 | using ScoopBox.Translators.Bat; 4 | using ScoopBox.Translators.Cmd; 5 | using ScoopBox.Translators.Powershell; 6 | using System.Collections.Generic; 7 | using System.IO; 8 | 9 | namespace Boxer.Utils 10 | { 11 | public static class TranslatorUtils 12 | { 13 | private static readonly Dictionary _translatorFactory; 14 | 15 | static TranslatorUtils() 16 | { 17 | _translatorFactory = new Dictionary() 18 | { 19 | { ".ps1", new PowershellTranslator() }, 20 | { ".bat", new BatTranslator() }, 21 | { ".cmd", new CmdTranslator() } 22 | }; 23 | } 24 | 25 | public static IPowershellTranslator GetTranslatorByExtensionType(string filePath) 26 | { 27 | string extension = Path.GetExtension(filePath); 28 | if (_translatorFactory.ContainsKey(extension)) 29 | { 30 | return _translatorFactory[extension]; 31 | } 32 | 33 | throw new NotSupportedFileTypeException($"File type {extension} not supported!"); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Boxer/Boxer/Program.cs: -------------------------------------------------------------------------------- 1 | using Boxer.DIC; 2 | using Boxer.Exceptions; 3 | using Boxer.Parser; 4 | using Microsoft.Extensions.DependencyInjection; 5 | using System; 6 | using System.Threading.Tasks; 7 | 8 | namespace Boxer 9 | { 10 | class Program 11 | { 12 | static async Task Main(string[] args) 13 | { 14 | IServiceProvider serviceProvider = new ServiceCollection() 15 | .RegisterConcreteTypes() 16 | .BuildServiceProvider(); 17 | 18 | var parser = serviceProvider.GetService(); 19 | 20 | try 21 | { 22 | await parser.Parse(args); 23 | } 24 | catch (Exception ex) 25 | when (ex is VerbNotFoundException || ex is ArgNotFoundException || ex is ParamNotFoundException) 26 | { 27 | Console.WriteLine(ex.Message); 28 | } 29 | catch (NotSupportedFileTypeException ex) 30 | { 31 | Console.WriteLine(ex.Message); 32 | 33 | Console.WriteLine($"{Environment.NewLine}Supported extensions are: .ps1, .bat, .cmd"); 34 | } 35 | catch (Exception ex) 36 | { 37 | Console.WriteLine($"{ex.Message}{Environment.NewLine}"); 38 | 39 | await parser.Parse(new string[] { "help" }); 40 | } 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/Boxer/Boxer/Args/Verbs/Parsers/HelpVerbParser.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Boxer.Args.Verbs.Parsers 8 | { 9 | public class HelpVerbParser : IVerbParser 10 | { 11 | private readonly IList _verbs; 12 | 13 | public HelpVerbParser() 14 | { 15 | IEnumerable verbTypes = AppDomain.CurrentDomain.GetAssemblies() 16 | .SelectMany(x => x.GetTypes()) 17 | .Where(x => typeof(IVerb).IsAssignableFrom(x) && !x.IsInterface && !x.IsAbstract); 18 | 19 | _verbs = new List(verbTypes.Select(v => (IVerb)Activator.CreateInstance(v))); 20 | } 21 | 22 | public Task Parse(Stack args) 23 | { 24 | IEnumerable commands = _verbs.Where(v => !string.IsNullOrEmpty(v.Help)).Select(v => v.Name.First()); 25 | 26 | StringBuilder helpBuilder = new StringBuilder(); 27 | helpBuilder.AppendLine(" Usage: boxer "); 28 | helpBuilder.AppendLine(); 29 | helpBuilder.AppendLine(" Where is one of:"); 30 | helpBuilder.AppendLine($" {string.Join(", ", commands)}"); 31 | helpBuilder.AppendLine(); 32 | helpBuilder.AppendLine($" boxer -h quick help on "); 33 | 34 | Console.WriteLine(helpBuilder); 35 | 36 | return Task.CompletedTask; 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Boxer/Boxer/Parser/CommandLineArgsParser.cs: -------------------------------------------------------------------------------- 1 | using Boxer.Args; 2 | using Boxer.Args.Factories; 3 | using Boxer.Args.Verbs.Parsers; 4 | using Boxer.Exceptions; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Linq; 8 | using System.Text; 9 | using System.Threading.Tasks; 10 | 11 | namespace Boxer.Parser 12 | { 13 | public class CommandLineArgsParser : ICommandLineArgsParser 14 | { 15 | private readonly IVerbParserFactory _verbParserFactory; 16 | 17 | public CommandLineArgsParser(IVerbParserFactory verbParserFactory) 18 | { 19 | _verbParserFactory = verbParserFactory; 20 | } 21 | 22 | public async Task Parse(string[] args) 23 | { 24 | IVerbParser parser = new HelpVerbParser(); 25 | Stack cliArgs = new Stack(); 26 | 27 | if (args.Any()) 28 | { 29 | cliArgs = new Stack(args.Reverse()); 30 | string verb = cliArgs.Pop(); 31 | 32 | parser = _verbParserFactory[verb]; 33 | if (parser == null) 34 | { 35 | StringBuilder helpBuilder = new StringBuilder() 36 | .AppendLine($"Command '{verb}' is not recognized! Try:") 37 | .AppendLine() 38 | .AppendLine(" boxer help"); 39 | 40 | throw new VerbNotFoundException(helpBuilder.ToString()); 41 | } 42 | } 43 | 44 | await parser.Parse(cliArgs); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/Boxer/Boxer/Boxer.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net5.0 6 | true 7 | boxer 8 | 9 | boxer 10 | boxer 11 | 0.1.0.0-preview1 12 | 0.1.0.0 13 | boxer 14 | boxer 15 | 16 | Boxer 17 | Hasan Hasanov 18 | Boxer is a cli tool that launches Windows Sandbox with preinstalled applications and/or executes scripts at startup. 19 | https://github.com/hasan-hasanov/Boxer 20 | Icon.png 21 | https://github.com/hasan-hasanov/Boxer 22 | github 23 | sanbox, windows-sandbox 24 | The initial release of Boxer cli tool. 25 | LICENSE.md 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | True 38 | 39 | 40 | 41 | True 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /src/Boxer/Boxer/Args/SharedArgs/Parsers/HelpArgParser.cs: -------------------------------------------------------------------------------- 1 | using ScoopBox.Scripts; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | 7 | namespace Boxer.Args.SharedArgs.Parsers 8 | { 9 | public class HelpArgParser : IArgParser 10 | { 11 | public List Parse(string arg) 12 | { 13 | string[] splitArgs = arg.Split(";"); 14 | 15 | Type commandArgsType = Type.GetType(splitArgs[0]); 16 | Type commandVerbType = Type.GetType(splitArgs[1]); 17 | 18 | IVerb commandVerb = Activator.CreateInstance(commandVerbType) as IVerb; 19 | IEnumerable commandArgs = AppDomain.CurrentDomain.GetAssemblies() 20 | .SelectMany(x => x.GetTypes()) 21 | .Where(x => commandArgsType.IsAssignableFrom(x) && !x.IsInterface && !x.IsAbstract); 22 | 23 | StringBuilder helpBuilder = new StringBuilder(); 24 | helpBuilder.AppendLine("COMMAND"); 25 | helpBuilder.AppendLine($" { commandVerb.Name.First() } - {commandVerb.Help}"); 26 | helpBuilder.AppendLine(); 27 | 28 | foreach (var commandArg in commandArgs) 29 | { 30 | IArg concreteCommandArg = Activator.CreateInstance(commandArg) as IArg; 31 | 32 | if (string.IsNullOrEmpty(concreteCommandArg.ShortName)) 33 | { 34 | helpBuilder.AppendLine($" {concreteCommandArg.LongName} - {concreteCommandArg.Help}"); 35 | } 36 | else 37 | { 38 | helpBuilder.AppendLine($" {concreteCommandArg.ShortName}, {concreteCommandArg.LongName} - {concreteCommandArg.Help}"); 39 | } 40 | } 41 | 42 | Console.WriteLine(helpBuilder.ToString()); 43 | return null; 44 | } 45 | } 46 | } -------------------------------------------------------------------------------- /src/Boxer/Boxer/Args/Verbs/Parsers/VersionVerbParser.cs: -------------------------------------------------------------------------------- 1 | using Boxer.Args.Factories; 2 | using Boxer.Args.SharedArgs.Parsers; 3 | using Boxer.Exceptions; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Reflection; 8 | using System.Text; 9 | using System.Threading.Tasks; 10 | 11 | namespace Boxer.Args.Verbs.Parsers 12 | { 13 | public class VersionVerbParser : IVerbParser 14 | { 15 | private readonly IArgParserFactory _argFactory; 16 | 17 | public VersionVerbParser(IArgParserFactory argFactory) 18 | { 19 | _argFactory = argFactory; 20 | } 21 | 22 | public Task Parse(Stack args) 23 | { 24 | string currentArgument = args != null && args.Count > 0 ? args.Pop() : null; 25 | if (currentArgument != null) 26 | { 27 | IArgParser parser = _argFactory[currentArgument]; 28 | 29 | if (parser is HelpArgParser) 30 | { 31 | var commandVerb = new VersionVerb(); 32 | StringBuilder helpBuilder = new StringBuilder() 33 | .AppendLine("COMMAND") 34 | .AppendLine($" {commandVerb.Name.First()} - {commandVerb.Help}"); 35 | 36 | Console.WriteLine(helpBuilder); 37 | 38 | return Task.CompletedTask; 39 | } 40 | else 41 | { 42 | StringBuilder helpBuilder = new StringBuilder() 43 | .AppendLine($"Argument '{currentArgument}' is not recognized! Try:") 44 | .AppendLine() 45 | .AppendLine(" boxer version --help"); 46 | 47 | throw new ArgNotFoundException(helpBuilder.ToString()); 48 | } 49 | } 50 | 51 | string version = Assembly.GetEntryAssembly().GetName().Version.ToString(); 52 | Console.WriteLine(version); 53 | 54 | return Task.CompletedTask; 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/Boxer/Boxer/Args/Verbs/Parsers/ScriptVerbParser.cs: -------------------------------------------------------------------------------- 1 | using Boxer.Args.Factories; 2 | using Boxer.Args.SharedArgs.Parsers; 3 | using Boxer.Exceptions; 4 | using Boxer.Handlers; 5 | using Boxer.Handlers.Sandbox; 6 | using ScoopBox.Scripts; 7 | using System; 8 | using System.Collections.Generic; 9 | using System.Text; 10 | using System.Threading.Tasks; 11 | 12 | namespace Boxer.Args.Verbs.Parsers 13 | { 14 | public class ScriptVerbParser : IVerbParser 15 | { 16 | private readonly List _scripts; 17 | private readonly IArgParserFactory _argFactory; 18 | private readonly IHandler _sandboxHandler; 19 | 20 | public ScriptVerbParser(IArgParserFactory argFactory, IHandler sandboxHandler) 21 | { 22 | _scripts = new List(); 23 | _argFactory = argFactory; 24 | _sandboxHandler = sandboxHandler; 25 | } 26 | 27 | public async Task Parse(Stack args) 28 | { 29 | if (args.Count == 0) 30 | { 31 | args.Push("-h"); 32 | } 33 | 34 | while (args.Count > 0) 35 | { 36 | string currentArgument = args.Pop(); 37 | IArgParser parser = _argFactory[currentArgument]; 38 | 39 | if (parser == null) 40 | { 41 | StringBuilder helpBuilder = new StringBuilder() 42 | .AppendLine($"Argument '{currentArgument}' is not recognized! Try:") 43 | .AppendLine() 44 | .AppendLine(" boxer script --help"); 45 | 46 | throw new ArgNotFoundException(helpBuilder.ToString()); 47 | } 48 | 49 | if (parser is HelpArgParser) 50 | { 51 | parser.Parse("Boxer.Args.ScriptArgs.IScriptArg;Boxer.Args.Verbs.ScriptVerb"); 52 | return; 53 | } 54 | 55 | if (args.Count == 0) 56 | { 57 | throw new ArgNotFoundException($"Parameter for argument '{currentArgument}' not found!{Environment.NewLine}"); 58 | } 59 | 60 | _scripts.AddRange(parser.Parse(args.Pop())); 61 | } 62 | 63 | await _sandboxHandler.HandleAsync(new SandboxRequest(_scripts)); 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/Boxer/Boxer/Args/ConfigArgs/Parsers/FileArgParser.cs: -------------------------------------------------------------------------------- 1 | using Boxer.Models; 2 | using Boxer.Utils; 3 | using ScoopBox.Scripts; 4 | using ScoopBox.Scripts.Materialized; 5 | using ScoopBox.Scripts.PackageManagers.Chocolatey; 6 | using ScoopBox.Scripts.PackageManagers.Scoop; 7 | using ScoopBox.Scripts.UnMaterialized; 8 | using System; 9 | using System.Collections.Generic; 10 | using System.IO; 11 | using System.Linq; 12 | using System.Text.Json; 13 | 14 | namespace Boxer.Args.ConfigArgs.Parsers 15 | { 16 | public class FileArgParser : IArgParser 17 | { 18 | private readonly Dictionary>> _configurationFactory; 19 | private readonly Func _readAllText; 20 | 21 | public FileArgParser() 22 | : this( 23 | new Dictionary>>() 24 | { 25 | { "FILE", config => new List(config.Args.Select(r => new ExternalScript(new FileInfo(r), TranslatorUtils.GetTranslatorByExtensionType(r)))) }, 26 | { "CHOCOLATEY", config => new List() { new ChocolateyPackageManagerScript(config.Args) } }, 27 | { "SCOOP", config => new List() { new ScoopPackageManagerScript(config.Args) } }, 28 | { "LITERAL", config => new List(config.Args.Select(r => new LiteralScript(config.Args))) }, 29 | }, 30 | path => File.ReadAllText(path)) 31 | { 32 | } 33 | 34 | internal FileArgParser( 35 | Dictionary>> configurationFactory, 36 | Func readAllText) 37 | { 38 | _configurationFactory = configurationFactory; 39 | _readAllText = readAllText; 40 | } 41 | 42 | public List Parse(string arg) 43 | { 44 | List scripts = new List(); 45 | List fileContent = new List(); 46 | 47 | string json = _readAllText(arg); 48 | fileContent = JsonSerializer.Deserialize>(json); 49 | 50 | foreach (var row in fileContent) 51 | { 52 | scripts.AddRange(_configurationFactory[row.Type.ToUpper()].Invoke(row)); 53 | } 54 | 55 | return scripts; 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/Boxer/Boxer/Args/Verbs/Parsers/ConfigVerbParser.cs: -------------------------------------------------------------------------------- 1 | using Boxer.Args.Factories; 2 | using Boxer.Args.SharedArgs.Parsers; 3 | using Boxer.Exceptions; 4 | using Boxer.Handlers; 5 | using Boxer.Handlers.Sandbox; 6 | using ScoopBox.Scripts; 7 | using System; 8 | using System.Collections.Generic; 9 | using System.Text; 10 | using System.Threading.Tasks; 11 | 12 | namespace Boxer.Args.Verbs.Parsers 13 | { 14 | public class ConfigVerbParser : IVerbParser 15 | { 16 | private readonly List _scripts; 17 | private readonly IArgParserFactory _argParserFactory; 18 | private readonly IHandler _sandboxHandler; 19 | 20 | public ConfigVerbParser(IArgParserFactory argParserFactory, IHandler sandboxHandler) 21 | { 22 | _scripts = new List(); 23 | _argParserFactory = argParserFactory; 24 | _sandboxHandler = sandboxHandler; 25 | } 26 | 27 | public async Task Parse(Stack args) 28 | { 29 | string currentArgument; 30 | IArgParser argParser; 31 | 32 | if (args.Count == 0) 33 | { 34 | args.Push("-h"); 35 | } 36 | 37 | while (args.Count > 0) 38 | { 39 | currentArgument = args.Pop(); 40 | argParser = _argParserFactory[currentArgument]; 41 | 42 | if (argParser == null) 43 | { 44 | StringBuilder helpBuilder = new StringBuilder() 45 | .AppendLine($"Argument '{currentArgument}' is not recognized! Try:") 46 | .AppendLine() 47 | .AppendLine(" boxer config --help"); 48 | 49 | throw new ArgNotFoundException(helpBuilder.ToString()); 50 | } 51 | 52 | if (argParser is HelpArgParser) 53 | { 54 | argParser.Parse("Boxer.Args.ConfigArgs.IConfigArg;Boxer.Args.Verbs.ConfigVerb"); 55 | return; 56 | } 57 | 58 | if (args.Count == 0) 59 | { 60 | throw new ArgNotFoundException($"Parameter for argument '{currentArgument}' not found!{Environment.NewLine}"); 61 | } 62 | 63 | _scripts.AddRange(argParser.Parse(args.Pop())); 64 | } 65 | 66 | await _sandboxHandler.HandleAsync(new SandboxRequest(_scripts)); 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /src/Boxer/Boxer/DIC/DependendencyResolver.cs: -------------------------------------------------------------------------------- 1 | using Boxer.Args.ConfigArgs; 2 | using Boxer.Args.ConfigArgs.Parsers; 3 | using Boxer.Args.Factories; 4 | using Boxer.Args.ScriptArgs; 5 | using Boxer.Args.ScriptArgs.Parsers; 6 | using Boxer.Args.SharedArgs; 7 | using Boxer.Args.SharedArgs.Parsers; 8 | using Boxer.Args.Verbs; 9 | using Boxer.Args.Verbs.Parsers; 10 | using Boxer.Handlers; 11 | using Boxer.Handlers.Sandbox; 12 | using Boxer.Parser; 13 | using Microsoft.Extensions.DependencyInjection; 14 | using ScoopBox; 15 | 16 | namespace Boxer.DIC 17 | { 18 | public static class DependendencyResolver 19 | { 20 | public static ServiceCollection RegisterConcreteTypes(this ServiceCollection serviceCollection) 21 | { 22 | serviceCollection.AddScoped(); 23 | serviceCollection.AddScoped(serviceProvider => 24 | { 25 | return new VerbParserFactory() 26 | { 27 | { new ScriptVerb(), new ScriptVerbParser(new ArgParserFactory() 28 | { 29 | { new FileScriptArg(), new FileScriptArgParser() }, 30 | { new ChocolateyScriptArg(), new ChocolateyArgParser()}, 31 | { new ScoopScriptArg(), new ScoopScriptArgsParser()}, 32 | { new LiteralScriptArg(), new LiteralScriptArgParser()}, 33 | { new HelpArg(), new HelpArgParser()} 34 | }, 35 | serviceProvider.GetService>()) }, 36 | 37 | { new ConfigVerb(), new ConfigVerbParser(new ArgParserFactory() 38 | { 39 | { new FileArg(), new FileArgParser()}, 40 | { new HelpArg(), new HelpArgParser()} 41 | }, 42 | serviceProvider.GetService>()) }, 43 | 44 | { new VersionVerb(), new VersionVerbParser(new ArgParserFactory() 45 | { 46 | { new HelpArg(), new HelpArgParser()} 47 | }) 48 | }, 49 | 50 | { new HelpVerb(), new HelpVerbParser() }, 51 | }; 52 | }); 53 | serviceCollection.AddScoped, SandboxHandler>(); 54 | serviceCollection.AddScoped(); 55 | 56 | return serviceCollection; 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 |
3 | scoopBoxLogo 4 |
5 | Boxer 6 |
7 |

8 | 9 |

Boxer is cli tool that helps launch Windows Sandbox with preinstalled applications.

10 |

:star: Stars on GitHub always helps!

11 | 12 |

13 | 14 | dotnet tool 15 | 16 |

17 | 18 |

19 | Windows Sandbox • 20 | ScoopBox • 21 | Boxer • 22 | Documentation • 23 | Download • 24 | Contribute 25 |

26 | 27 | ## Windows Sandbox 28 | Technically [Windows Sandbox](https://docs.microsoft.com/en-us/windows/security/threat-protection/windows-sandbox/windows-sandbox-overview "Windows Sandbox Documentation") is a lightweight virtual machine created on demand which a user can safely run applications in isolation. This virtual machine is using the same OS image as in the host machine. Software installed inside the Windows Sandbox environment remains "sandboxed" and runs separately from the base machine. 29 | 30 | Windows sandbox should be enabled before first use. [Check how here.](https://docs.microsoft.com/en-us/windows/security/threat-protection/windows-sandbox/windows-sandbox-overview#installation "Windows Sandbox Installation") 31 | 32 | ## ScoopBox 33 | [ScoopBox](https://github.com/hasan-hasanov/ScoopBox) is a C# library that helps you launch the Windows Sandbox with preinstalled applications using package managers Scoop and Chocolate. 34 | 35 | _You can find more information about Windows Sandbox and ScoopBox in my [blog](https://hasan-hasanov.com/2020/11/25/scoopbox/)._ 36 | 37 | ## Boxer 38 | Boxer is a cli tool that launches Windows Sandbox with preinstalled applications or execute scripts at startup. It takes full advantage of the [ScoopBox](https://github.com/hasan-hasanov/ScoopBox) library implementing and exposing all the functionalities to the end user. 39 | 40 | ### Quick Start 41 | Start Windows Sandbox with predefined applications using Chocolatey: 42 | ``` 43 | boxer script --chocolatey "git,fiddler,vscode" 44 | ``` 45 | 46 | Start Windows Sandbox with predefined applications using Scoop: 47 | ``` 48 | boxer script --scoop "git,fiddler,vscode" 49 | ``` 50 | 51 | Start Windows Sandbox with startup scripts: 52 | ``` 53 | boxer script -f "C:/Script1.ps1; C:/Script2.ps1" 54 | ``` 55 | 56 | Start Windows Sandbox with startup scripts and applications: 57 | ``` 58 | boxer script -f "C:/PrepareSandbox.ps1" --chocolatey "git,vscode" -f "C:/CloneRepository.ps1;C:/PrepareDevEnvironment.ps1" 59 | ``` 60 | ## Documentation 61 | ### Commands 62 | 63 | * **script** - Executes scripts and installs aplications in sandbox. 64 | * **--chocolatey** - Applications that will be installed with Chocolatey, should be separated by comma (,). 65 | * **--scoop** - Applications that will be installed with Scoop, should be separated by comma (,). 66 | * **-f, --file-script** - Full path of the script file including the extension. Supported extensions are **.ps1**, **.bat**, **.cmd** 67 | * **-s, --literal-script** - Single powershell command. 68 | * **config** - Launch Windows Sandbox using configuration file. 69 | * **-f, --file** - Path to the config file. Only json configuration is supported. 70 | * **version** - Displays the version of the project in the format: **MAJOR.MINOR.BUILD.REVISION** 71 | * **help** - Displays help for commands and arguments. 72 | 73 | ### Config 74 | The configuration should be in the following structure: 75 | 76 | ```json 77 | [ 78 | { 79 | "args":[], 80 | "type":"" 81 | } 82 | ] 83 | ``` 84 | Supported types in the schema: 85 | * type: **File** 86 | * **args:** - Full script file paths 87 | * type: **Chocolatey** 88 | * **args:** - Applications to install using Chocolatey package manager 89 | * type: **Scoop** 90 | * **args:** - Applications to install using Scoop package manager 91 | * type: **Literal** 92 | * **args** - Powershell commands that will be executed 93 | 94 | **Here are some valid configuration files that you can use:** 95 | 96 | Configuration that installs git and fiddler using Chocolatey and vscode using Scoop package managers: 97 | 98 | ```json 99 | [ 100 | { 101 | "args":["git", "fiddler"], 102 | "type":"Chocolatey" 103 | }, 104 | { 105 | "args":["vscode"], 106 | "type":"Scoop" 107 | } 108 | ] 109 | ``` 110 | 111 | Configuration that runs **PrepareEnvironment.ps1** script. After the preparation installs vs code and cleans up all the resources. Latsly when everything is done starts notepad. 112 | ```json 113 | [ 114 | { 115 | "args":["C:\\PrepareEnvironment.ps1"], 116 | "type":"File" 117 | }, 118 | { 119 | "args":["vscode"], 120 | "type":"Scoop" 121 | }, 122 | { 123 | "args":["C:/Cleanup.ps1"], 124 | "type":"File" 125 | }, 126 | { 127 | "args":["Start-Process 'C:\\windows\\system32\\notepad.exe'"], 128 | "type":"Literal" 129 | } 130 | ] 131 | ``` 132 | **The order matters. All the scripts are ran in the order they are defined.** 133 | 134 | ## Download 135 | 136 | Coming soon as dotnet tool, chocolatey, scoop and winget 137 | 138 | ## Contribute 139 | 140 | ### Did you find a bug? 141 | 142 | Ensure the bug was not already reported by searching on GitHub under Issues. 143 | If you're unable to find an open issue addressing the problem, open a new one. Be sure to include a title and clear description, as much relevant information as possible. 144 | 145 | ### Did you write a patch that fixes a bug? 146 | 147 | Open a new GitHub pull request with the patch. 148 | Ensure the PR description clearly describes the problem and solution. Include the relevant issue number if applicable. 149 | 150 | ### Did you fix whitespace, format code, or make a purely cosmetic patch? 151 | Open a new GitHub pull request with the patch. 152 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.rsuser 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Mono auto generated files 17 | mono_crash.* 18 | 19 | # Build results 20 | [Dd]ebug/ 21 | [Dd]ebugPublic/ 22 | [Rr]elease/ 23 | [Rr]eleases/ 24 | x64/ 25 | x86/ 26 | [Aa][Rr][Mm]/ 27 | [Aa][Rr][Mm]64/ 28 | bld/ 29 | [Bb]in/ 30 | [Oo]bj/ 31 | [Ll]og/ 32 | [Ll]ogs/ 33 | 34 | # Visual Studio 2015/2017 cache/options directory 35 | .vs/ 36 | # Uncomment if you have tasks that create the project's static files in wwwroot 37 | #wwwroot/ 38 | 39 | # Visual Studio 2017 auto generated files 40 | Generated\ Files/ 41 | 42 | # MSTest test Results 43 | [Tt]est[Rr]esult*/ 44 | [Bb]uild[Ll]og.* 45 | 46 | # NUnit 47 | *.VisualState.xml 48 | TestResult.xml 49 | nunit-*.xml 50 | 51 | # Build Results of an ATL Project 52 | [Dd]ebugPS/ 53 | [Rr]eleasePS/ 54 | dlldata.c 55 | 56 | # Benchmark Results 57 | BenchmarkDotNet.Artifacts/ 58 | 59 | # .NET Core 60 | project.lock.json 61 | project.fragment.lock.json 62 | artifacts/ 63 | 64 | # StyleCop 65 | StyleCopReport.xml 66 | 67 | # Files built by Visual Studio 68 | *_i.c 69 | *_p.c 70 | *_h.h 71 | *.ilk 72 | *.meta 73 | *.obj 74 | *.iobj 75 | *.pch 76 | *.pdb 77 | *.ipdb 78 | *.pgc 79 | *.pgd 80 | *.rsp 81 | *.sbr 82 | *.tlb 83 | *.tli 84 | *.tlh 85 | *.tmp 86 | *.tmp_proj 87 | *_wpftmp.csproj 88 | *.log 89 | *.vspscc 90 | *.vssscc 91 | .builds 92 | *.pidb 93 | *.svclog 94 | *.scc 95 | 96 | # Chutzpah Test files 97 | _Chutzpah* 98 | 99 | # Visual C++ cache files 100 | ipch/ 101 | *.aps 102 | *.ncb 103 | *.opendb 104 | *.opensdf 105 | *.sdf 106 | *.cachefile 107 | *.VC.db 108 | *.VC.VC.opendb 109 | 110 | # Visual Studio profiler 111 | *.psess 112 | *.vsp 113 | *.vspx 114 | *.sap 115 | 116 | # Visual Studio Trace Files 117 | *.e2e 118 | 119 | # TFS 2012 Local Workspace 120 | $tf/ 121 | 122 | # Guidance Automation Toolkit 123 | *.gpState 124 | 125 | # ReSharper is a .NET coding add-in 126 | _ReSharper*/ 127 | *.[Rr]e[Ss]harper 128 | *.DotSettings.user 129 | 130 | # TeamCity is a build add-in 131 | _TeamCity* 132 | 133 | # DotCover is a Code Coverage Tool 134 | *.dotCover 135 | 136 | # AxoCover is a Code Coverage Tool 137 | .axoCover/* 138 | !.axoCover/settings.json 139 | 140 | # Visual Studio code coverage results 141 | *.coverage 142 | *.coveragexml 143 | 144 | # NCrunch 145 | _NCrunch_* 146 | .*crunch*.local.xml 147 | nCrunchTemp_* 148 | 149 | # MightyMoose 150 | *.mm.* 151 | AutoTest.Net/ 152 | 153 | # Web workbench (sass) 154 | .sass-cache/ 155 | 156 | # Installshield output folder 157 | [Ee]xpress/ 158 | 159 | # DocProject is a documentation generator add-in 160 | DocProject/buildhelp/ 161 | DocProject/Help/*.HxT 162 | DocProject/Help/*.HxC 163 | DocProject/Help/*.hhc 164 | DocProject/Help/*.hhk 165 | DocProject/Help/*.hhp 166 | DocProject/Help/Html2 167 | DocProject/Help/html 168 | 169 | # Click-Once directory 170 | publish/ 171 | 172 | # Publish Web Output 173 | *.[Pp]ublish.xml 174 | *.azurePubxml 175 | # Note: Comment the next line if you want to checkin your web deploy settings, 176 | # but database connection strings (with potential passwords) will be unencrypted 177 | *.pubxml 178 | *.publishproj 179 | 180 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 181 | # checkin your Azure Web App publish settings, but sensitive information contained 182 | # in these scripts will be unencrypted 183 | PublishScripts/ 184 | 185 | # NuGet Packages 186 | *.nupkg 187 | # NuGet Symbol Packages 188 | *.snupkg 189 | # The packages folder can be ignored because of Package Restore 190 | **/[Pp]ackages/* 191 | # except build/, which is used as an MSBuild target. 192 | !**/[Pp]ackages/build/ 193 | # Uncomment if necessary however generally it will be regenerated when needed 194 | #!**/[Pp]ackages/repositories.config 195 | # NuGet v3's project.json files produces more ignorable files 196 | *.nuget.props 197 | *.nuget.targets 198 | 199 | # Microsoft Azure Build Output 200 | csx/ 201 | *.build.csdef 202 | 203 | # Microsoft Azure Emulator 204 | ecf/ 205 | rcf/ 206 | 207 | # Windows Store app package directories and files 208 | AppPackages/ 209 | BundleArtifacts/ 210 | Package.StoreAssociation.xml 211 | _pkginfo.txt 212 | *.appx 213 | *.appxbundle 214 | *.appxupload 215 | 216 | # Visual Studio cache files 217 | # files ending in .cache can be ignored 218 | *.[Cc]ache 219 | # but keep track of directories ending in .cache 220 | !?*.[Cc]ache/ 221 | 222 | # Others 223 | ClientBin/ 224 | ~$* 225 | *~ 226 | *.dbmdl 227 | *.dbproj.schemaview 228 | *.jfm 229 | *.pfx 230 | *.publishsettings 231 | orleans.codegen.cs 232 | 233 | # Including strong name files can present a security risk 234 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 235 | #*.snk 236 | 237 | # Since there are multiple workflows, uncomment next line to ignore bower_components 238 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 239 | #bower_components/ 240 | 241 | # RIA/Silverlight projects 242 | Generated_Code/ 243 | 244 | # Backup & report files from converting an old project file 245 | # to a newer Visual Studio version. Backup files are not needed, 246 | # because we have git ;-) 247 | _UpgradeReport_Files/ 248 | Backup*/ 249 | UpgradeLog*.XML 250 | UpgradeLog*.htm 251 | ServiceFabricBackup/ 252 | *.rptproj.bak 253 | 254 | # SQL Server files 255 | *.mdf 256 | *.ldf 257 | *.ndf 258 | 259 | # Business Intelligence projects 260 | *.rdl.data 261 | *.bim.layout 262 | *.bim_*.settings 263 | *.rptproj.rsuser 264 | *- [Bb]ackup.rdl 265 | *- [Bb]ackup ([0-9]).rdl 266 | *- [Bb]ackup ([0-9][0-9]).rdl 267 | 268 | # Microsoft Fakes 269 | FakesAssemblies/ 270 | 271 | # GhostDoc plugin setting file 272 | *.GhostDoc.xml 273 | 274 | # Node.js Tools for Visual Studio 275 | .ntvs_analysis.dat 276 | node_modules/ 277 | 278 | # Visual Studio 6 build log 279 | *.plg 280 | 281 | # Visual Studio 6 workspace options file 282 | *.opt 283 | 284 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 285 | *.vbw 286 | 287 | # Visual Studio LightSwitch build output 288 | **/*.HTMLClient/GeneratedArtifacts 289 | **/*.DesktopClient/GeneratedArtifacts 290 | **/*.DesktopClient/ModelManifest.xml 291 | **/*.Server/GeneratedArtifacts 292 | **/*.Server/ModelManifest.xml 293 | _Pvt_Extensions 294 | 295 | # Paket dependency manager 296 | .paket/paket.exe 297 | paket-files/ 298 | 299 | # FAKE - F# Make 300 | .fake/ 301 | 302 | # CodeRush personal settings 303 | .cr/personal 304 | 305 | # Python Tools for Visual Studio (PTVS) 306 | __pycache__/ 307 | *.pyc 308 | 309 | # Cake - Uncomment if you are using it 310 | # tools/** 311 | # !tools/packages.config 312 | 313 | # Tabs Studio 314 | *.tss 315 | 316 | # Telerik's JustMock configuration file 317 | *.jmconfig 318 | 319 | # BizTalk build output 320 | *.btp.cs 321 | *.btm.cs 322 | *.odx.cs 323 | *.xsd.cs 324 | 325 | # OpenCover UI analysis results 326 | OpenCover/ 327 | 328 | # Azure Stream Analytics local run output 329 | ASALocalRun/ 330 | 331 | # MSBuild Binary and Structured Log 332 | *.binlog 333 | 334 | # NVidia Nsight GPU debugger configuration file 335 | *.nvuser 336 | 337 | # MFractors (Xamarin productivity tool) working folder 338 | .mfractor/ 339 | 340 | # Local History for Visual Studio 341 | .localhistory/ 342 | 343 | # BeatPulse healthcheck temp database 344 | healthchecksdb 345 | 346 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 347 | MigrationBackup/ 348 | 349 | # Ionide (cross platform F# VS Code tools) working folder 350 | .ionide/ 351 | -------------------------------------------------------------------------------- /assets/Icon.svg: -------------------------------------------------------------------------------- 1 | --------------------------------------------------------------------------------