Shell Structure
Explaining the inner workings of all the kernel shells
Kernel shells can be built by implementing two different interfaces and base classes. Why two? Because the shell handler relies on:
BaseShellandIShell: To hold shell type and initialization codeBaseShellInfo<ShellType>andIShellInfo: To hold shell commands and the base shell
To learn more about general information about shells, consult the page below:
ShellsIf you want to know about Nitrocid-specific additions, read on.
Networked shells
Networked shells are shells that are aware of the network client object, such as the FTP client or the SFT client object. They are useful for building CLI applications that use built-in shells to interact with a remote server over the network.
Attaching and Detaching
Every single client that Nitrocid implements support attachment to existing connections and detachment from the current connection. When you use one of the clients for the first time, it lets you create a new connection. From there, you have to specify some info about which server you're going to connect, the username, and the password, depending on the client.
When you're connected to any server, you can detach the current connection, which causes you to go back to your shell when you're still connected. In order to attach back to your session, use the same command that you used to create a new connection to connect to the existing server or to create a second new connection.
To detach, simply use the detach command to go back to your shell.
Speed dial for networked shells
Speed dial allows you to quickly connect to servers with your username, your address, your port, and your custom network configuration. This will save time in having to enter address information manually each time you connect to the same server.
When you invoke a command that launches your networked shell (FTP for example), a selection window shows up with the option to either select an established connection, an option to create a new connection manually, or connect to the saved networks using the speed dial functionality.
Return codes
The kernel exceptions can be used as return codes, though you'll have to reference to a class, called KernelExceptionTools, to be able to get an error code by exception type using the GetErrorCode() function.
In addition to that, you can also use it with an instance of a kernel exception instance, in case you've wrapped the code with the try and catch clause and that you're catching all the KernelException errors, which almost all APIs throw on either a failure condition or an invalid operation.
All kernel exception codes consist of 10000 added with the enumeration number of the kernel exception type.
Example of getting error code from kernel exception type
Here's a minimal example of what exit does when you're trying to exit the mother shell:
Error code list
The error code variable, MESHErrorCode, holds information about the last process error code, whether it's a success (a zero value) or a failure (non-zero value).
In addition to what Terminaux already provides, these values are supported:
Error codes that come from the commands
-3
Indicates that the command is attempting to be run in maintenance mode and the command forbids that
-4
Indicates that the command is a strict command and the user doesn't have permissions to execute it
10000 + KernelExceptionType
Some commands throw this value from any KernelException that is thrown by the command executor. Indicates that the command failed to perform its operation, but the kernel already knows about it.
Example: If KernelExceptionType.Config is thrown from the command executor, and the command knows how to return this exception as an error code, such as using KernelExceptionTools.GetErrorCode(), then it'll return the sum of 10000 + 7, which is 10007.
Command-specific error codes
1
Indicates that the command answered n to the confirmation (FTP and SFTP's del command)
2
Indicates that either the real or the imaginary number is not valid (imaginary command)
3
Indicates that the unit type is not found (listunits command)
Theme preview has exited by user request (themeprev command)
Theme set has exited by user request (themeset command)
4
Indicates that the hashes don't match (verify command)
5
Indicates that the version code can't be formed (version command)
Indicates that the action taken is invalid (todo command)
6
Indicates that the version code can't be formed (platform command)
7
Indicates that the line endings converter can't convert binary files (convertlineendings command)
8
Indicates that the note number is not numeric (removenote command)
9
Indicates that the repository has been modified (checkout command)
10
Indicates that the branch doesn't exist (checkout command)
11
Indicates that the repository has been modified (fetch command)
12
Indicates that the remote doesn't exist (fetch command)
13
Indicates that there are no remotes to pull updates from (fetch command)
14
Indicates that you need to identify yourself (pull command)
15
Indicates that you need to identify yourself (maketag and commit command)
16
Indicates that the culture is not found (altdate command)
17
Indicates that there is no such lyric file (playlyric command)
20
Indicates that the number of columns is invalid (wraptext command)
21
Indicates that the extension handler is not registered (getdefaultexthandler command)
22
Indicates that the extension handler is not registered (getexthandlers command)
23
Indicates that the extension is not registered (setexthandler command)
24
Indicates that the extension implementer is not registered (setexthandler command)
25
Indicates that the port number is invalid (netfminfo command)
26
Indicates that the number of seconds or the drink name is invalid (caffeine command)
27
Indicates that there is no such lyric file (lyriclines command)
28
Indicates that there is no config or key (getconfigvalue, setconfigvalue, and lsconfigvalues command)
29
Indicates that the music file is not found (playsound command)
30
Indicates that the MPG123 library has timed out (playsound command)
32
Indicates that there are no caffeine alerts to abort (caffeine command)
33
Indicates that this command is not supported on Windows (showmainbuffer command)
34
Indicates that the dock is not found (dock command)
35
Indicates that user didn't provide file or content (pastebin command)
36
Indicates that the provider type of pastebin is not raw, http, or https (pastebin command)
37
Indicates that pastebin has failed (pastebin command)
38
Indicates that latitude and longitude is needed (weather command)
39
Indicates that the path is not provided or image is not found (preview command)
40
Indicates that the API call for AlphaVantage has failed (stock command)
41
Indicates that there is no SQL database connection (dbinfo command)
42
Indicates that the file stream is not open for JSON (tui command)
43
Indicates that there is no repository (all Git commands)
44
Indicates that there is no chemical substance (element command)
45
Indicates that the expiry date info is invalid (expiry command)
46
Indicates that the mode is not specified (ismode command)
Last updated