public RenderCommand(SeqConnectionFactory connectionFactory, SeqCliConfig config) { if (config == null) { throw new ArgumentNullException(nameof(config)); } _connectionFactory = connectionFactory ?? throw new ArgumentNullException(nameof(connectionFactory)); Options.Add( "i=|id=", "The id of a single dashboard to render", t => _id = ArgumentString.Normalize(t)); Options.Add("c=|chart=", "The title of a chart on the dashboard to render", c => _chartTitle = ArgumentString.Normalize(c)); Options.Add("last=", "A duration over which the chart should be rendered, e.g. `7d`; this will be aligned to an interval boundary; either `--last` or `--start` and `--end` must be specified", v => _lastDuration = ArgumentString.Normalize(v)); Options.Add("by=", "The time-slice interval for the chart data, as a duration, e.g. `1h`", v => _intervalDuration = ArgumentString.Normalize(v)); _range = Enable <DateRangeFeature>(); _signal = Enable <SignalExpressionFeature>(); _timeout = Enable <TimeoutFeature>(); _output = Enable(new OutputFormatFeature(config.Output)); _connection = Enable <ConnectionFeature>(); }
public PrintCommand(SeqCliOutputConfig outputConfig) { if (outputConfig == null) { throw new ArgumentNullException(nameof(outputConfig)); } _noColor = outputConfig.DisableColor; _forceColor = outputConfig.ForceColor; _fileInputFeature = Enable(new FileInputFeature("CLEF file to read", supportsWildcard: true)); Options.Add("f=|filter=", "Filter expression to select a subset of events", v => _filter = ArgumentString.Normalize(v)); Options.Add("template=", "Specify an output template to control plain text formatting", v => _template = ArgumentString.Normalize(v)); _invalidDataHandlingFeature = Enable <InvalidDataHandlingFeature>(); Options.Add("no-color", "Don't colorize text output", v => _noColor = true); Options.Add("force-color", "Force redirected output to have ANSI color (unless `--no-color` is also specified)", v => _forceColor = true); }
private bool RunCommand(ArgumentString commandText) { pbResultCommand.Image = DpiUtil.Scale(Resource.StatusHourglass); ShowToolTip(pbResultCommand, "running command : git " + commandText); ForceRefresh(pbResultCommand); lblRunCommand.Text = "git " + commandText; ForceRefresh(lblRunCommand); txtResult.Text = "running..."; ForceRefresh(txtResult); var result = _gitUiCommands.GitModule.GitExecutable.Execute(commandText); IsRefreshNeeded = true; ttDebug.RemoveAll(); ttDebug.SetToolTip(lblDebug, "cmd: git " + commandText + "\n" + "exit code:" + result.ExitCode); var resultText = Regex.Replace(result.AllOutput, @"\r\n?|\n", Environment.NewLine); if (result.ExitCode == 0) { pbResultCommand.Image = DpiUtil.Scale(Resource.success); ShowToolTip(pbResultCommand, resultText); DisplayHead(); } else { pbResultCommand.Image = DpiUtil.Scale(Resource.error); ShowToolTip(pbResultCommand, "error: " + resultText); } txtResult.Text = resultText; return(result.ExitCode == 0); }
public CreateCommand(SeqConnectionFactory connectionFactory, SeqCliConfig config) { _connectionFactory = connectionFactory ?? throw new ArgumentNullException(nameof(connectionFactory)); Options.Add( "n=|name=", "A unique name for the feed", n => _name = ArgumentString.Normalize(n)); Options.Add( "l=|location=", "The feed location; this may be a NuGet v2 or v3 feed URL, or a local filesystem path on the Seq server", l => _location = ArgumentString.Normalize(l)); Options.Add( "u=|username="******"The username Seq should supply when connecting to the feed, if authentication is required", n => _username = ArgumentString.Normalize(n)); Options.Add( "p=|password="******"A feed password, if authentication is required; note that `--password-stdin` is more secure", p => _password = ArgumentString.Normalize(p)); Options.Add( "password-stdin", "Read the feed password from `STDIN`", _ => _passwordStdin = true); _connection = Enable <ConnectionFeature>(); _output = Enable(new OutputFormatFeature(config.Output)); }
public void Description() { IArgument param = new ArgumentString("Fred"); param.Description = "Description"; Assert.AreEqual("Description", param.Description); }
public ImportCommand(SeqConnectionFactory connectionFactory) { _connectionFactory = connectionFactory; Options.Add( "i=|input=", "The directory from which to read the set of `.template` files; the default is `.`", i => _inputDir = ArgumentString.Normalize(i)); Options.Add( "state=", "The path of a file which will persist a mapping of template names to the ids of the created " + "entities on the target server, avoiding duplicates when multiple imports are performed; by default, " + "`import.state` in the input directory will be used", s => _stateFile = ArgumentString.Normalize(s)); Options.Add( "merge", "For templates with no entries in the `.state` file, first check for existing entities with matching names or titles; " + "does not support merging of retention policies", _ => _merge = true); _args = Enable(new PropertiesFeature("g", "arg", "Template arguments, e.g. `-g ownerId=user-314159`")); _connection = Enable <ConnectionFeature>(); }
public CreateCommand(SeqConnectionFactory connectionFactory, SeqCliConfig config) { _connectionFactory = connectionFactory ?? throw new ArgumentNullException(nameof(connectionFactory)); Options.Add( "t=|title=", "A title for the API key", t => _title = ArgumentString.Normalize(t)); Options.Add( "token=", "A pre-allocated API key token; by default, a new token will be generated and written to `STDOUT`", t => _token = ArgumentString.Normalize(t)); _properties = Enable <PropertiesFeature>(); Options.Add( "filter=", "A filter to apply to incoming events", f => _filter = ArgumentString.Normalize(f)); Options.Add( "minimum-level=", "The minimum event level/severity to accept; the default is to accept all events", v => _level = ArgumentString.Normalize(v)); Options.Add( "use-server-timestamps", "Discard client-supplied timestamps and use server clock values", _ => _useServerTimestamps = true); _connection = Enable <ConnectionFeature>(); _output = Enable(new OutputFormatFeature(config.Output)); }
public RunCommand(SeqCliConfig config) { if (config == null) { throw new ArgumentNullException(nameof(config)); } _serverUrl = config.Connection.ServerUrl; Options.Add( "d=|directory=", "The directory containing .NET Standard assemblies; defaults to the current directory", d => _dir = ArgumentString.Normalize(d) ?? _dir); Options.Add( "type=", "The [SeqApp] plug-in type name; defaults to scanning assemblies for a single type marked with this attribute", t => _type = ArgumentString.Normalize(t)); Options.Add( "p={=}|property={=}", "Specify name/value settings for the app, e.g. `-p [email protected] -p Subject=\"Alert!\"`", (n, v) => { var name = n.Trim(); var valueText = v?.Trim(); _settings.Add(name, valueText ?? ""); }); Options.Add( "storage=", "A directory in which app-specific data can be stored; defaults to the current directory", d => _storage = ArgumentString.Normalize(d) ?? _storage); Options.Add("s=|server=", "The URL of the Seq server, used only for app configuration (no connection is made to the server); by default the `connection.serverUrl` value will be used", v => _serverUrl = ArgumentString.Normalize(v) ?? _serverUrl); Options.Add( "server-instance=", "The instance name of the Seq server, used only for app configuration; defaults to no instance name", v => _seqInstanceName = ArgumentString.Normalize(v)); Options.Add( "t=|title=", "The app instance title, used only for app configuration; defaults to a placeholder title.", v => _appInstanceTitle = ArgumentString.Normalize(v)); Options.Add( "id=", "The app instance id, used only for app configuration; defaults to a placeholder id.", v => _appInstanceId = ArgumentString.Normalize(v)); Options.Add( "read-env", "Read app configuration and settings from environment variables, as specified in " + "https://docs.datalust.co/docs/seq-apps-in-other-languages; ignores all options " + "except --directory and --type", _ => _readEnv = true); }
public static string ReadDialog(IWin32Window?owner, string?process, ArgumentString arguments, string workingDirectory, string?input, bool useDialogSettings) { Debug.Assert(owner is not null, "Progress window must be owned by another window! This is a bug, please correct and send a pull request with a fix."); using var formProcess = new FormProcess(commands: null, process, arguments, workingDirectory, input, useDialogSettings); formProcess.ShowDialog(owner); return(formProcess.GetOutputString()); }
public static new bool ShowDialog(IWin32Window owner, GitModule module, ArgumentString arguments) { using (var formRemoteProcess = new FormRemoteProcess(module, arguments)) { formRemoteProcess.ShowDialog(owner); return(!formRemoteProcess.ErrorOccurred()); } }
public static bool ShowDialog(IWin32Window owner, GitUICommands commands, ArgumentString arguments) { using (var formRemoteProcess = new FormRemoteProcess(commands, process: null, arguments)) { formRemoteProcess.ShowDialog(owner); return(!formRemoteProcess.ErrorOccurred()); } }
public void Constructor() { IArgument param = new ArgumentString("key", "value"); Assert.AreEqual("key", param.Caption); Assert.AreEqual("value", param.Value); IArgument param2 = new ArgumentString(param); Assert.AreEqual(param, param2); }
public void ReadOnly() { ArgumentString param = new ArgumentString("Fred"); param.IsReadOnly = true; Assert.AreEqual(true, param.IsReadOnly); param.IsReadOnly = false; Assert.AreEqual(false, param.IsReadOnly); }
public override void Enable(OptionSet options) { options.Add("s=|server=", "The URL of the Seq server; by default the `connection.serverUrl` value will be used", v => Url = ArgumentString.Normalize(v)); options.Add("a=|apikey=", "The API key to use when connecting to the server; by default `connection.apiKey` value will be used", v => ApiKey = ArgumentString.Normalize(v)); }
public CreateCommand(SeqConnectionFactory connectionFactory, SeqCliConfig config) { _connectionFactory = connectionFactory ?? throw new ArgumentNullException(nameof(connectionFactory)); Options.Add( "t=|title=", "A title for the API key", t => _title = ArgumentString.Normalize(t)); Options.Add( "token=", "A pre-allocated API key token; by default, a new token will be generated and written to `STDOUT`", t => _token = ArgumentString.Normalize(t)); _properties = Enable <PropertiesFeature>(); Options.Add( "filter=", "A filter to apply to incoming events", f => _filter = ArgumentString.Normalize(f)); Options.Add( "minimum-level=", "The minimum event level/severity to accept; the default is to accept all events", v => _level = ArgumentString.Normalize(v)); Options.Add( "use-server-timestamps", "Discard client-supplied timestamps and use server clock values", _ => _useServerTimestamps = true); Options.Add( "permissions=", "A comma-separated list of permissions to delegate to the API key; valid permissions are `Ingest` (default), `Read`, `Write`, `Project` and `System`", v => _permissions = ArgumentString.NormalizeList(v)); Options.Add( "connect-username="******"A username to connect with, useful primarily when setting up the first API key", v => _connectUsername = ArgumentString.Normalize(v)); Options.Add( "connect-password="******"When `connect-username` is specified, a corresponding password", v => _connectPassword = ArgumentString.Normalize(v)); Options.Add( "connect-password-stdin", "When `connect-username` is specified, read the corresponding password from `STDIN`", _ => _connectPasswordStdin = true); _connection = Enable <ConnectionFeature>(); _output = Enable(new OutputFormatFeature(config.Output)); }
string NumStringExpr() { if ((5.3).ToString().Contains(',')) { return(ArgumentString.Replace('.', ',')); } else { return(ArgumentString); } }
public HealthCommand(SeqConnectionFactory connectionFactory) { _connectionFactory = connectionFactory; Options.Add("s=|server=", "The URL of the Seq server; by default the `connection.serverUrl` config value will be used", v => _serverUrl = ArgumentString.Normalize(v)); Options.Add("profile=", "A connection profile to use; by default the `connection.serverUrl` and `connection.apiKey` config values will be used", v => _profileName = ArgumentString.Normalize(v)); }
public CreateCommand() { Options.Add("n=|name=", "The name of the connection profile", v => _name = ArgumentString.Normalize(v)); Options.Add("s=|server=", "The URL of the Seq server", v => _url = ArgumentString.Normalize(v)); Options.Add("a=|apikey=", "The API key to use when connecting to the server, if required", v => _apiKey = ArgumentString.Normalize(v)); }
public void Equals() { IArgument param1 = new ArgumentString("key", "value"); IArgument param2 = new ArgumentString("key", "value"); Assert.IsTrue(param1.Equals(param2)); param1.Caption = "key1"; Assert.IsFalse(param1.Equals(param2)); param1.Caption = "key"; param1.Value = "value1"; Assert.IsFalse(param1.Equals(param2)); Assert.IsFalse(param1.Equals(null)); Assert.IsFalse(param1.Equals("string")); }
public async Task <IEnumerable <AutoCompleteWord> > GetAutoCompleteWordsAsync(CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); var autoCompleteWords = new HashSet <string>(); IGitModule module = GetModule(); ArgumentString cmd = GitCommandHelpers.GetAllChangedFilesCmd(true, UntrackedFilesMode.Default, noLocks: true); var output = await module.GitExecutable.GetOutputAsync(cmd).ConfigureAwait(false); IReadOnlyList <GitItemStatus> changedFiles = _getAllChangedFilesOutputParser.Parse(output); foreach (var file in changedFiles) { cancellationToken.ThrowIfCancellationRequested(); var regex = GetRegexForExtension(PathUtil.GetExtension(file.Name)); if (regex is not null) { // HACK: need to expose require methods at IGitModule level var text = await GetChangedFileTextAsync((GitModule)module, file); var matches = regex.Matches(text); foreach (Match match in matches) { // Skip first group since it always contains the entire matched string (regardless of capture groups) foreach (Group group in match.Groups.OfType <Group>().Skip(1)) { foreach (Capture capture in group.Captures) { autoCompleteWords.Add(capture.Value); } } } } autoCompleteWords.Add(Path.GetFileNameWithoutExtension(file.Name)); autoCompleteWords.Add(Path.GetFileName(file.Name)); if (!string.IsNullOrWhiteSpace(file.OldName)) { autoCompleteWords.Add(Path.GetFileNameWithoutExtension(file.OldName)); autoCompleteWords.Add(Path.GetFileName(file.OldName)); } } return(autoCompleteWords.Select(w => new AutoCompleteWord(w))); }
public CreateCommand(SeqConnectionFactory connectionFactory, SeqCliConfig config) { _connectionFactory = connectionFactory ?? throw new ArgumentNullException(nameof(connectionFactory)); Options.Add( "n=|name=", "A unique username for the user", u => _username = ArgumentString.Normalize(u)); Options.Add( "d=|display-name=", "A long-form name to aid in identifying the user", d => _displayName = ArgumentString.Normalize(d)); Options.Add( "f=|filter=", "A view filter that limits the events visible to the user", f => _filter = ArgumentString.Normalize(f)); Options.Add( "r=|role=", "The title of a role that grants the user permissions on the server; if not specified, the default new user role will be assigned", r => _roleTitle = ArgumentString.Normalize(r)); Options.Add( "e=|email=", "The user's email address (enables a Gravatar image for the user)", e => _emailAddress = ArgumentString.Normalize(e)); Options.Add( "p=|password="******"An initial password for the user, if username/password authentication is in use; note that `--password-stdin` is more secure", p => _password = ArgumentString.Normalize(p)); Options.Add( "password-stdin", "Read the initial password for the user from `STDIN`, if username/password authentication is in use", _ => _passwordStdin = true); Options.Add( "no-password-change", "Don't force the user to change their password at next login", _ => _noPasswordChange = true); _connection = Enable <ConnectionFeature>(); _output = Enable(new OutputFormatFeature(config.Output)); }
bool _deleteAllEvents; // Currently the only supported option public CreateCommand(SeqConnectionFactory connectionFactory, SeqCliConfig config) { _connectionFactory = connectionFactory ?? throw new ArgumentNullException(nameof(connectionFactory)); Options.Add( "after=", "A duration after which the policy will delete events, e.g. `7d`", v => _afterDuration = ArgumentString.Normalize(v)); Options.Add( "delete-all-events", "The policy should delete all events (currently the only supported option)", _ => _deleteAllEvents = true); _connection = Enable <ConnectionFeature>(); _output = Enable(new OutputFormatFeature(config.Output)); }
public ApplyCommand(SeqConnectionFactory connectionFactory) { _connectionFactory = connectionFactory ?? throw new ArgumentNullException(nameof(connectionFactory)); Options.Add("c=|certificate=", "Certificate file; the file must be UTF-8 text", v => _certificateFilename = ArgumentString.Normalize(v)); Options.Add("certificate-stdin", "Read the license certificate from `STDIN`", _ => _certificateStdin = true); Options.Add("automatically-refresh", "If the license is for a subscription, periodically check `datalust.co` and automatically refresh " + "the certificate when the subscription is changed or renewed", _ => _automaticallyRefresh = true); _connection = Enable <ConnectionFeature>(); }
private FormProcess(ConsoleOutputControl outputControl, [CanBeNull] string process, ArgumentString arguments, string workingDirectory, string input, bool useDialogSettings) : base(outputControl, useDialogSettings) { ProcessCallback = ProcessStart; AbortCallback = ProcessAbort; ProcessString = process ?? AppSettings.GitCommand; ProcessArguments = arguments; Remote = ""; ProcessInput = input; WorkingDirectory = workingDirectory; var displayPath = PathUtil.GetDisplayPath(WorkingDirectory); if (!string.IsNullOrWhiteSpace(displayPath)) { Text += $" ({displayPath})"; } ConsoleOutput.ProcessExited += delegate { OnExit(ConsoleOutput.ExitCode); }; ConsoleOutput.DataReceived += DataReceivedCore; }
public DefineCommand(SeqCliConfig config) { if (config == null) { throw new ArgumentNullException(nameof(config)); } Options.Add( "d=|directory=", "The directory containing .NET Standard assemblies; defaults to the current directory", d => _dir = ArgumentString.Normalize(d) ?? _dir); Options.Add( "type=", "The [SeqApp] plug-in type name; defaults to scanning assemblies for a single type marked with this attribute", t => _type = ArgumentString.Normalize(t)); Options.Add( "indented", "Format the definition over multiple lines with indentation", _ => _indented = true); }
public void With_CountAllVisitsAndOutputFile() { // Arrange var options = new ParsedCommandLineOptions(); const string ArgumentString = "-c test.ink"; string[] args = ArgumentString.Split(" "); var tool = new CommandLineTool(); // Act tool.ParseArguments(args, options); // Assert options.Should().NotBeNull("because the parsing should succeed"); options.InputFilePath.Should().BeEquivalentTo("test.ink"); options.OutputFilePath.Should().BeNull("because none was given"); options.IsCountAllVisitsNeeded.Should().BeTrue("because the count all visits flag was set"); options.IsPlayMode.Should().BeFalse("because the playmode flag was not set"); options.IsVerboseMode.Should().BeFalse("because the verbose flag was not set"); options.IsKeepOpenAfterStoryFinishNeeded.Should().BeFalse("because the keep running after finished flag was not set"); }
public CreateCommand(SeqConnectionFactory connectionFactory, SeqCliConfig config) { _connectionFactory = connectionFactory ?? throw new ArgumentNullException(nameof(connectionFactory)); Options.Add( "t=|title=", "A title for the signal", t => _title = ArgumentString.Normalize(t)); Options.Add( "description=", "A description for the signal", d => _description = ArgumentString.Normalize(d)); Options.Add( "f=|filter=", "Filter to associate with the signal", f => _filter = ArgumentString.Normalize(f)); Options.Add( "group=", "An explicit group name to associate with the signal; the default is to infer the group from the filter", g => _group = ArgumentString.Normalize(g)); Options.Add( "no-group", "Specify that no group should be inferred; the default is to infer the group from the filter", _ => _noGrouping = true); Options.Add( "protected", "Specify that the signal is editable only by administrators", _ => _isProtected = true); _connection = Enable <ConnectionFeature>(); _output = Enable(new OutputFormatFeature(config.Output)); }
public CreateCommand(SeqConnectionFactory connectionFactory, SeqCliConfig config) { _connectionFactory = connectionFactory ?? throw new ArgumentNullException(nameof(connectionFactory)); Options.Add( "t=|title=", "A title for the workspace", t => _title = ArgumentString.Normalize(t)); Options.Add( "description=", "A description for the workspace", d => _description = ArgumentString.Normalize(d)); Options.Add( "dashboard=", "The id of a dashboard to include in the workspace", d => _dashboards.Add(ArgumentString.Normalize(d))); Options.Add( "query=", "The id of a saved query to include in the workspace", s => _queries.Add(ArgumentString.Normalize(s))); Options.Add( "signal=", "The id of a signal to include in the workspace", s => _signals.Add(ArgumentString.Normalize(s))); Options.Add( "protected", "Specify that the workspace is editable only by administrators", _ => _isProtected = true); _connection = Enable <ConnectionFeature>(); _output = Enable(new OutputFormatFeature(config.Output)); }
public RunCommand(SeqCliConfig config) { if (config == null) { throw new ArgumentNullException(nameof(config)); } _serverUrl = config.Connection.ServerUrl; Options.Add( "d=|directory=", "The directory containing .NET Standard assemblies; defaults to the current directory", d => _dir = ArgumentString.Normalize(d) ?? _dir); Options.Add( "t|type=", "The [SeqApp] plug-in type name; defaults to scanning assemblies for a single type marked with this attribute", t => _type = ArgumentString.Normalize(t)); Options.Add( "p={=}|property={=}", "Specify name/value settings for the app, e.g. `-p [email protected] -p Subject=\"Alert!\"`", (n, v) => { var name = n.Trim(); var valueText = v?.Trim(); _settings.Add(name, valueText ?? ""); }); Options.Add("s=|server=", "The URL of the Seq server, used only for app configuration (no connection is made to the server); by default the `connection.serverUrl` value will be used", v => _serverUrl = ArgumentString.Normalize(v) ?? _serverUrl); Options.Add( "storage=", "A directory in which app-specific data can be stored; defaults to the current directory", d => _storage = ArgumentString.Normalize(d) ?? _storage); }
private string[] ParseArgumentString(out string retvalue) { // Check arg string for null if (string.IsNullOrEmpty(ArgumentString)) { retvalue = null; return(null); } // Strip whitespace string argstr = new string(ArgumentString.Where(c => !char.IsWhiteSpace(c)).ToArray()); // Split by return value indicator string[] leftright = argstr.Split(new[] { "=>" }, StringSplitOptions.RemoveEmptyEntries); if (leftright.Length == 0) { retvalue = null; return(null); } // Split by comma string[] args = leftright[0].Split(','); // Set the return value if (leftright.Length > 1) { retvalue = leftright[1]; } else { retvalue = null; } // Return return(args); }
public void Key() { IArgument param = new ArgumentString("OperationKey"); Assert.AreEqual("OperationKey", param.Caption); }
public void Value() { IArgument param = new ArgumentString("id1", "OperationValue"); Assert.AreEqual("OperationValue", param.Value); }