AshShell class
Provides a number of helper functions when dcli needs to interact with the Bash shell.
- Implemented types
- Mixed-in types
Constructors
- AshShell.withPid(int? pid)
- Attached to an Ash shell with the give 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 setterinherited
- 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 the instructions to install DCli.
no setterinherited
- 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 setterinherited
- isPrivilegedProcess → bool
-
True if the processes real uid is root.
no setterinherited
- isPrivilegedUser → bool
-
True if the processes effictive uid is root.
no setterinherited
- isSudo → bool
-
Returns true if we are currently running under sudo.
no setterinherited
- loggedInUser → String
-
returns the username of the logged in user.
no setterinherited
- loggedInUsersHome → String
-
Attempts to retrive the logged in user's home directory.
no setterinherited
- name → String
-
The name of the shell
e.g. bash
no setteroverride
-
nonPriviledgedUser
→ Immutable<
UserEnvironment> -
latefinalinherited
- 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
-
priviledgedUser
→ Immutable<
UserEnvironment> -
latefinalinherited
- 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
-
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? -
at this point no posix system has any preconditions.
inherited
-
install(
{bool installDart = false, bool activate = true}) → Future< bool> -
Install dart/dcli
inherited
-
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 -
The message used during installation if it needs to be run with sudo.
inherited
-
releasePrivileges(
) → void -
revert uid and gid to original user's id's
You should note that your PATH will still be
the SUDO PATH not your original user's PATH.
inherited
-
restorePrivileges(
) → void -
If a prior call to releasePrivileges has
been made then this command will restore
those privileges
If releasePrivileges hasn't been called then
this method does nothing.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
withPrivileges(
RunPrivileged action, {bool allowUnprivileged = false}) → void -
Run
action
with root UID and gidinherited
Operators
-
operator ==(
covariant Shell other) → bool -
The equality operator.
inherited