-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
renaming status context to environment and adding environment variabl…
…e functionality adding commands for setting and displaying environment variables
- Loading branch information
Showing
23 changed files
with
584 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -348,3 +348,4 @@ MigrationBackup/ | |
|
||
# Ionide (cross platform F# VS Code tools) working folder | ||
.ionide/ | ||
/src.bak |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
src/Xcaciv.Command.Interface/Attributes/BaseCommandAttribute.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Xcaciv.Command.Interface.Attributes | ||
{ | ||
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)] | ||
public class BaseCommandAttribute : Attribute | ||
{ | ||
private string _command; | ||
/// <summary> | ||
/// define how this command is to be called | ||
/// </summary> | ||
/// <param name="command"></param> | ||
/// <param name="description"></param> | ||
public BaseCommandAttribute(string command = "", string description = "") | ||
{ | ||
this._command = command.ToUpper(); | ||
this.Description = description; | ||
} | ||
/// <summary> | ||
/// the base command string | ||
/// </summary> | ||
/// <example>DIR</example> | ||
public string Command { | ||
get | ||
{ return this._command; } | ||
set | ||
{ this._command = value.ToUpper(); } | ||
} | ||
/// <summary> | ||
/// What does this command do | ||
/// </summary> | ||
public string Description { get; set; } = "TODO"; | ||
/// <summary> | ||
/// Prototype/example of how to call the command with parameters parameters | ||
/// </summary> | ||
/// <example>CMD [-A | -U] [-Q] [-D] [-E ON | OFF]</example> | ||
public string Prototype { get; set; } = "TODO"; | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
src/Xcaciv.Command.Interface/Attributes/CommandHelpRemarksAttribute.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Xcaciv.Command.Interface.Attributes | ||
{ | ||
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = false)] | ||
public class CommandHelpRemarksAttribute : Attribute | ||
{ | ||
/// <summary> | ||
/// add remarks to help output | ||
/// </summary> | ||
/// <param name="remarks"></param> | ||
public CommandHelpRemarksAttribute(string remarks) | ||
{ | ||
this.Remarks = remarks; | ||
} | ||
/// <summary> | ||
/// further explination to be displayed in help | ||
/// </summary> | ||
public string Remarks { get; set; } | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
src/Xcaciv.Command.Interface/Attributes/CommandParameterAttribute.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Xcaciv.Command.Interface.Attributes | ||
{ | ||
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = false)] | ||
public class CommandParameterAttribute : Attribute | ||
{ | ||
private string _valueName = "TODO"; | ||
|
||
public CommandParameterAttribute(string name, string description = "") | ||
{ | ||
this.ValueName = name; | ||
} | ||
|
||
public CommandParameterAttribute(string flagname, string name, string description = "") | ||
{ | ||
this.FlagName = flagname; | ||
this.ValueName = name; | ||
} | ||
|
||
public CommandParameterAttribute(string abbrFlag, string flagname, string name, string description = "") | ||
{ | ||
this.AbbrFlagName = abbrFlag; | ||
this.FlagName = flagname; | ||
this.ValueName = name; | ||
} | ||
|
||
public string AbbrFlagName { get; } = ""; | ||
public string FlagName { get; set; } = ""; | ||
|
||
public string ValueName | ||
{ | ||
get { return _valueName; } | ||
set { _valueName = String.Format(@"<{0}>", value.Trim('>').Trim(']')); } | ||
} | ||
|
||
public string ValueDescription { get; set; } = ""; | ||
|
||
public override string ToString() | ||
{ | ||
return $"{AbbrFlagName} {FlagName} \t {_valueName} \t {ValueDescription}".Trim(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.