public override bool Execute(string[] arguments)
        {
            var args = new InstallPsArguments();

            if (!ArgumentParser.ParseArguments(arguments, args))
            {
                return(false);
            }


            FsPath target = new FsPath(args.Files[0]);

            StringBuilder contents = new StringBuilder(4096);

            if (args.Dotnet)
            {
                var dnc = ResourceHandler.GetResourceFile <KnownFile>("Powershell/completer.dn.ps1");
                contents.Append(dnc);
            }

            var completer = ResourceHandler.GetResourceFile <KnownFile>("Powershell/completer.ps1");

            contents.Append(completer);

            target.WriteFile(CurrentState.Log, contents.ToString());

            return(true);
        }
Esempio n. 2
0
        private bool TryCreateShellScript(out string shellScriptPath)
        {
            try
            {
                var name = Path.GetTempFileName();
                name = Path.ChangeExtension(name, ".ps1");

                using (var file = File.CreateText(name))
                {
                    var dn = ResourceHandler.GetResourceFile <KnownFile>("Powershell/completer.dn.ps1");
                    var bg = ResourceHandler.GetResourceFile <KnownFile>("Powershell/completer.ps1");

                    file.WriteLine("$env:Path += \";{0}\"", _appdir);
                    file.WriteLine("Set-Location \"{0}\"", _selectedFolder);
                    file.WriteLine(dn);
                    file.WriteLine(bg);
                    file.WriteLine("Remove-Item \"{0}\"", name);
                    file.WriteLine("echo \"To get info on using bookgen type: Bookgen Help\"");
                    file.WriteLine("echo \"To get list of commands type: Bookgen SubCommands\"");
                    file.WriteLine("echo \"\"");
                }

                shellScriptPath = name;
                return(true);
            }
            catch (IOException)
            {
                shellScriptPath = string.Empty;
                return(false);
            }
        }
        public override bool Execute(string[] arguments)
        {
            var args = new InstallPsArguments();

            if (!ArgumentParser.ParseArguments(arguments, args))
            {
                return(false);
            }


            ILog   log    = new ConsoleLog(LogLevel.Info);
            FsPath target = new FsPath(args.Files[0]);

            StringBuilder contents = new StringBuilder(4096);

            if (args.Dotnet)
            {
                var dnc = ResourceHandler.GetResourceFile <GeneratorRunner>("Resources/completer.dn.ps1");
                contents.Append(dnc);
            }

            var completer = ResourceHandler.GetResourceFile <GeneratorRunner>("Resources/completer.ps1");

            contents.Append(completer);

            target.WriteFile(log, contents.ToString());

            return(true);
        }
Esempio n. 4
0
 public static string GetHelpForModule(string moduleClass)
 {
     return(ResourceHandler.GetResourceFile <GeneratorRunner>($"Resources/Help.{moduleClass}.txt"));
 }
Esempio n. 5
0
 public static string GetGeneralHelp()
 {
     return(ResourceHandler.GetResourceFile <GeneratorRunner>("Resources/Help.General.txt"));
 }