Skip to content

Instantly share code, notes, and snippets.

@ZingBallyhoo
Last active February 9, 2020 15:18
Show Gist options
  • Save ZingBallyhoo/1bb35ee450714dac5d309e0b9663b327 to your computer and use it in GitHub Desktop.
Save ZingBallyhoo/1bb35ee450714dac5d309e0b9663b327 to your computer and use it in GitHub Desktop.
DataTool Util Modes JSON format
// root = DynamicChoicesContainer
public class DynamicChoicesContainer {
public Dictionary<string, DynamicChoiceType> Types = new Dictionary<string, DynamicChoiceType>();
}
public class DynamicChoiceType {
public List<DynamicChoice> Choices = new List<DynamicChoice>();
}
public class DynamicChoice {
public string QueryName; // unique string that can be used in query
public string DisplayName; // name should only be used for display
public DynamicChoicesContainer Children; // names that are scoped inside this choice
}
// root = ToolInfo
public class ToolInfo {
public Dictionary<string, string> Version = new Dictionary<string, string>(); // verision info for multiple assemblies
public FlagGroup ToolFlags; // global tool flags
public Dictionary<string, ToolGroup> ToolGroups = new Dictionary<string, ToolGroup>(); // list of tool groups
}
public class ToolGroup {
public FlagGroup Flags; // flag list
public List<Tool> Tools = new List<Tool>(); // tool list
}
public class QueryInfo {
public string DynamicChoicesKey; // dynamic choice key
public List<QueryTypeJSON> Types = new List<QueryTypeJSON>(); // list of types e.g "skin"
}
public class QueryTypeJSON {
public string Name; // name that should be used for query
public string HumanName; // human readable name only
public string DynamicChoicesKey; // dynamic values
public List<QueryTagJSON> Tags; // list of tags e.g "event"
}
public class QueryTagJSON {
public string Name; // query string name
public string HumanName; // human readable name
public string DynamicChoicesKey; // if not null, these are valid alongside the FixedValues
public List<string> FixedValues; // non-dynamic values
}
public class Tool {
public string Name; // tool name, not set often
public string Keyword; // tool keyword e.g "list-maps"
public string Description; // tool description
public bool SupportsJson; // true if mode supports json output
public bool SupportsQuery; // true if mode supports query parser
public QueryInfo QueryInfo; // query parser info (only if SupportsQuery)
}
public class FlagGroup {
public List<Flag> Flags; // list of flags that are implemented by this group only (excluding parent)
public string Name; // internal name
public string Parent; // flags from parent should also be considered
}
public enum FlagValueType {
Invalid,
String,
Char,
Boolean,
Int,
Byte
}
public class Flag {
public string Name; // raw flag name
public string HelpText; // description
public bool Required; // is required to be set
public bool TakesValue; // true -> --{flag}={value}. false -> --{flag}
public FlagValueType ValueType; // type
public bool IsPositional; // must be set at certain position
public int Position; // position flag must be set at
public string[] Choices; // valid choices for this flag
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment