Settings Format
Each of the settings contain their own format
This page specifies all the possible configuration formats.
Kernel Configuration Entries
The most basic pseudo-representation of the settings entry file is printed below to illustrate the concept:
[
{
"Name": "SectionName",
"Desc": "Description of the section, usually a short one.",
"DisplayAs": "Section name to be displayed in the app",
"Keys": [
{
"Name": "Key name to be displayed in the app",
"Type": "SType",
"Variable": "VarName",
"Description": "Description of the key, usually a short one."
}
]
}
]Basically, all of the settings entry files start with an array containing one or more of the sections under the selected name for reference.
Configuration section entries
Each section contains these necessary entries:
Name
This variable holds the short section name.
string
Desc
This variable holds the description of the section to be displayed in the bottom of the application.
string, localizable
DisplayAs
This variable holds the text to display in the settings application.
string, localizable
Keys
This variable holds the settings entries.
array
Configuration key entries
In the Keys variable, it contains an array of objects containing the settings entry information. They get used by the settings application to determine what to do when getting and setting the variable value.
The entry information is detailed below (in general case):
Name
This contains the key name to be displayed by the settings application.
string, localizable
Type
The type of a variable, depending on the variable and on the purpose.
string
Variable
The variable to get and to set the values from/to.
string
Description
The description of the entry, to describe what is the purpose.
string, localizable
Optional key entry variables
The variables that can be omitted are specified below:
Masked
Specifies whether the string is a secret or not (shows as asterisks when editing).
boolean
IsEnumeration
If the variable is an enumeration, set to true.
boolean
IsValuePath
If the value takes a path, then true.
boolean
IsPathCurrentPath
If the value takes a relative path, then true to neutralize the input path to the current path.
boolean
UnsupportedPlatforms
The value is unsupported on one or more of the host platforms. The settings application won't display this value on an unsupported platform.
array of strings, one of "windows", "unix", "macos"
ValuePathType
The path type to use for values. IsPathCurrentPath must be false.
string
Requirements for key types
In special cases, each type might require different variables to be set before the settings application knows what to do.
These types are listed below:
SBooleanSIntSStringSSelectionSListSColorSCharSIntSliderSDoubleSPresetSFigletSMultivar
Only the types that require additional configuration are listed below. The below variables must be set to work with these types:
SSelection
This type is a selection from the list of the values that a function or an enumeration returns.
Case 1: (IsEnumeration is false)
IsEnumeration is false)The format is as below:
If the target listing is not an enumeration, the list can be obtained using a function that returns a list of possible options that can be set here.
SelectionFunctionName
The function within the below specified type that returns the list. It must contain no arguments.
string
SelectionFunctionType
The type containing the function above (must be a fully-qualified type name).
string
SelectionFunctionArgs
An array of arguments to be passed to the function (if omitted, nothing is passed to the function).
object
SelectionFallback
An array of the fallback values in case the function fails.
array
SelectionFunctionArgs is an object that contains the two keys:
ArgType
A fully qualified name of a target type (must be simple types, such as System.String).
string
ArgValue
A valid value that can be converted to the target type.
string
In the SelectionFunctionArgs value, please make sure that you pass the correct number of parameters in their correct order and in their correct types.
Case 2: (IsEnumeration is true)
IsEnumeration is true)The format is as below:
If the target listing is an enumeration, the list can be obtained immediately with a list of possible options that can be set here.
EnumerationInternal
Specifies whether the enumeration is found within the kernel or within an external assembly.
boolean
Enumeration
The fully qualified name of the enumeration, including the whole namespace.
If internal, Nitrocid. can be omitted.
Enumerations inside the static classes must be appended with the plus sign, for example, ConsoleBase.Inputs.Styles.ChoiceStyle+ChoiceOutputType.
string
EnumerationAssembly
An assembly name containing the enumeration. It can be omitted if enumeration is internal.
string
EnumerationZeroBased
If the enumeration is zero-based, then true. Otherwise, the enumeration is assumed to start from one.
boolean
SList
This type allows lists to be made in kernel settings. It contains list of configured values.
Case 1 (dynamic delimiter)
The format is as below:
The target list is always a parameterless function that always returns a list that is found under a Nitrocid type. The list type takes a string and splits it using the specified delimiter found in a variable.
SelectionFunctionName
The function within the below specified type that returns the list. It must contain no arguments.
string
SelectionFunctionType
The type containing the function above.
string
DelimiterVariable
The variable containing the delimiter character.
string
DelimiterVariableType
The type containing the delimiter variable name (must be a fully-qualified type name)
string
Case 2 (hardcoded delimiter)
The format is as below:
The target list is always a parameterless function that always returns a list that is found under a Nitrocid KS type. The list type takes a string and splits it using the specified delimiter.
SelectionFunctionName
The function within the below specified type that returns the list. It must contain no arguments.
string
SelectionFunctionType
The type containing the function above.
string
Delimiter
The delimiter character.
string
SPreset
This type is a shell preset that is treated as a string in the kernel configuration file, but it's actually set by the shell preset manager.
General case
The format is as below:
It provides only one variable, ShellType, that specifies the shell type for listing all the presets. It delegates the listing functions to PromptPresetManager.PromptForPresets() function with the shell type in the Nitrocid.Shell.Prompts namespace.
SelectionFunctionName
The function within the below specified type that returns the list. It must contain no arguments.
string
SIntSlider
This type is for integer values which are limited. They're surrounded between the minimum number and the maximum number, which can be represented like this (x is a value):
Nmin<x<Nmax
General case
The format is as below:
There are two variables that must be set. One for the minimum value and one for the maximum value.
MinimumValue
The minimum value to be set.
integer
MaximumValue
The maximum value to be set.
integer
SMultivar
This type is to group multiple settings entries, which are indicated in an array value of the Variables key in the entries JSON file. The format is as below:
You can nest the SMultivar entries, since the Variables value gets deserialized into an array of the settings entries instance used internally, and the settings application takes this into account.
Other configuration types
There are other configuration types that different parts of Nitrocid uses, such as user configuration.
User Configuration
The kernel makes a user configuration entry for each new user created either by the adduser command or by the call of the UserManagement.InitializeUser() function in the Nitrocid.Users namespace under the name of Users.json found in the kernel configuration directory.
Format
The format of the file looks like this:
Explanation
Let's explain each key one by one:
Username
Stores the username.
string
FullName
Stores the full name.
string
PreferredLanguage
Stores the preferred user language in three-letter language name format. Can be left blank to use the kernel-wide language.
string
Groups
What groups the user is in?
array of string
Password
Stores the password.
string (SHA256)
Flags
Specifies a number representing the flags.
integer
Permissions
Stores the array of permissions found under the permission list, PermissionTypes.
array of string
CustomSettings
Specifies the customized settings entries
array of properties
The type of Flags is an integer that can be a sum of the following flags:
1: Administrator2: Anonymous4: Disabled
Group configuration
The kernel also supports user groups created either by the addgroup command or by the call of the GroupManagement.AddGroup() function in the Nitrocid.Users.Groups namespace under the name of UserGroups.json found in the kernel configuration directory.
Format
The format of the file looks like this:
Explanation
Let's explain each key one by one:
GroupName
The name of the group.
string
Permissions
Stores the array of permissions found under the permission list, PermissionTypes.
array of strings
Alias configuration
The kernel makes an alias configuration entry for each new alias created either by the alias command or by the call of the AliasManager.ManageAlias() function in the Nitrocid.Shell.ShellBase.Aliases namespace under the name of Aliases.json found in the kernel configuration directory.
Format
The format of the file looks like this:
Explanation
Let's explain each key one by one:
Alias
Stores the alias.
string
Command
Stores the target command.
string
Type
The shell type
boolean
Debug Device Configuration
The kernel makes a debug device configuration entry for each new device connected to the remote debugger under the name of DebugDevicesNames.json found in the kernel configuration directory.
Format
The format of the file looks like this:
Explanation
Let's explain each key one by one:
Address
Stores the device address.
string
Name
Stores the name of the remote debug device.
string
Blocked
Whether the device is banned or not.
boolean
MuteLogs
Whether to mute the kernel debug logs or not. Useful for conversations.
boolean
ChatHistory
Recent chat history
array of strings
Event configuration
The kernel makes an event file for each event made in the KSEvents folder by calendar event saveall.
Format
The format of the file looks like this:
Explanation
Let's explain each key one by one:
EventDate
Stores the date (and time) of the event.
date
EventTitle
The event title that's usually what's happening on the specified date.
string
IsYearly
Whether or not this event is a yearly event.
boolean
StartMonth
For yearly events, specifies the start month.
integer
StartDay
For yearly events, specifies the start day.
integer
EndMonth
For yearly events, specifies the end month.
integer
EndDay
For yearly events, specifies the end day.
integer
Calendar
The calendar used while parsing the event date.
string
Reminder configuration
The kernel makes a reminder file for each reminder made in the KSReminders folder by calendar reminder saveall.
Format
The format of the file looks like this:
Explanation
Let's explain each key one by one:
ReminderDate
Stores the date (and time) of the reminder.
date
ReminderTitle
The reminder title that's usually what you're reminded of.
string
ReminderImportance
The reminder importance shows how important is the thing that you're reminded of.
string
where ReminderImportance is one of Low, Medium, or High.
MAL and MOTD configuration
The configuration files for the message of the day before login (MOTD) and after login (MAL) are found under the kernel configuration directory. They are just plain-text files with the kernel placeholder support found in the below page linked to you below:
Both of these files are read every time the kernel log-in handler starts. The functions that are responsible for loading such info are both the ReadMotd() and the ReadMal() functions found under their respective namespaces Nitrocid.Misc.Probers.Motd and Nitrocid.Misc.Probers.Mal.
Changes to both files are done by the SetMotd() and the SetMal() functions under the same namespace. They're invoked either manually or by the usage of the chmotd and the chmal commands in the main shell.
Last updated