UnknownShell class

Used by dcli to interacte with the shell environment when we are unable to detect what shell is active. This may simply be the parent process of the dart app so not a shell at all.

Implemented types

Constructors

UnknownShell.withPid(int? pid, {String? processName})
Attached to the Unknown shell with the given pid.

Properties

canModifyPath bool
Returns true if this shell supports modifying the shell's PATH
no setteroverride
hashCode int
The hash code for this object.
no setteroverride
hasStartScript bool
True if this shell supports a start script or configuration file. e.g. a script that is run by the shell or a configuration file that is read when the shell starts.
no setteroverride
installInstructions String
Returns instructions on how to install DCli.
no setteroverride
isCompletionInstalled bool
no setteroverride
isCompletionSupported bool
no setteroverride
isPrivilegedPasswordRequired bool
Returns true if running a privileged action would cause a password to be requested.
no setteroverride
isPrivilegedProcess bool
Returns true if the process was launched as a priviliged process.
no setteroverride
isPrivilegedUser bool
Returns true if the current user this process is running as has esclated privileges.
no setteroverride
isSudo bool
A derived class should overload this method and return true if the script is running under sudo.
no setteroverride
loggedInUser String?
Returns the username of the logged in user.
no setteroverride
name String
The name of the shell e.g. bash
no setteroverride
pathToStartScript String
Returns the path to the shell's start script or config file e.g /home/
no setteroverride
pid int?
The pid of the current shell
final
processName String?
The name of the shell process.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
startScriptName String
Returns the name of the shell's startup script or configuration file e.g. .bashrc
no setteroverride

Methods

addFileAssocation(String dcliPath) → void
Called during the install so that an OS that needs to create a file association between .dart and dcli can create that association. The implementor is responsible for not adding the association if it already exists.
override
addToPATH(String path) bool
Adds a path to the start script returns true if adding the path was successful
override
appendPathToMacOsPathd(String path) bool
appendToPATH(String path) bool
Appends path to the end of the PATH in a persistent manner. Note: this doesn't update current scripts path. Returns true if we successfully appended the path. In almost all shells you will need to restart the terminal in order for the path change to take affect.
override
checkInstallPreconditions() String?
Some OS/Shell combinations have some preconditions that must be met before dcli can be installed.
override
install({bool installDart = false, bool activate = true}) bool
Installs dart and dcli. Returns true if dart was installed. Returns false if dart was already installed.
override
installTabCompletion({bool quiet = false}) → void
If the shell supports tab completion then install it. If quiet is true then suppress any console output except for errors.
override
matchByName(String name) bool
Returns true if the shells name matches the passed name. The comparison is case insensitive.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
prependToPATH(String path) bool
Prepends path to the start of the PATH in a persistent manner. Note: this doesn't update current scripts path. Returns true if we successfully prepended the path. In almost all shells you will need to restart the terminal in order for the path change to take affect.
override
privilegesRequiredMessage(String app) String
Returns a message informing the user that they need to run as a priviledged user to run an app.
override
releasePrivileges() → void
On Linux and MacOS systems makes the script run as a non-privileged user even when started with sudo.
override
restorePrivileges() → void
If releasePrivileges has been called then this method will restore those privileges See
override
toString() String
A string representation of this object.
inherited
withPrivileges(RunPrivileged action, {bool allowUnprivileged = false}) → void
When a script is run under sudo on Linux and MacOS and you have previously called releasePrivileges then this method will run action with root privileges.
override

Operators

operator ==(covariant UnknownShell other) bool
The equality operator.
override

Constants

shellName → const String
Name of the shell