Shell class abstract
an abstract class which allows each shell (bash, zsh) to provide specific implementation of features required by DCli.
- Implementers
- Annotations
-
- @immutable
Constructors
- Shell()
Properties
- 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 setter
- isCompletionInstalled → bool
-
no setter
- isCompletionSupported → bool
-
no setter
- isPrivilegedProcess → bool
-
Returns true if the process was launched as a priviliged process.
no setter
- isPrivilegedUser → bool
-
Returns true if the current user this process
is running as has esclated privileges.
no setter
- isSudo → bool
-
A derived class should overload this method and return true
if the script is running under sudo.
no setter
- loggedInUser → String?
-
Returns the username of the logged in user.
no setter
- name → String
-
The name of the shell
e.g. bash
no setter
- pathToStartScript → String?
-
Returns the path to the shell's start script or config file
e.g /home/
no setter
- pid → int?
-
The pid of the current shell
no setter
- 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 setter
Methods
-
addToPATH(
String path) → bool - Adds a path to the start script returns true if adding the path was successful
-
checkInstallPreconditions(
) → String? - Some OS/Shell combinations have some preconditions that must be met before dcli can be installed.
-
install(
{bool installDart = false}) → bool - Installs dart and dcli. Returns true if dart was installed. Returns false if dart was already installed.
-
installTabCompletion(
{bool quiet = true}) → void -
If the shell supports tab completion then
install it.
If
quiet
is true then suppress any console output except for errors. -
matchByName(
String name) → bool -
Returns true if the shells name matches
the passed
name
. The comparison is case insensitive. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
privilegesRequiredMessage(
String appname) → String - Returns a message informing the user that they need to run as a priviledged user to run an app.
-
releasePrivileges(
) → void - On Linux and osx systems makes the script run as a non-privileged user even when started with sudo.
-
toString(
) → String -
A string representation of this object.
inherited
-
withPrivileges(
RunPrivileged privilegedCallback) → void -
When a script is run under sudo on Linux and osx and you
have previously called releasePrivileges then this method
will run
privilegedCallback
with root privileges.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- current → Shell
-
Returns the user shell that this script was launched from
e.g. bash, powershell, ....
If the shell can't be deteremined then the UnknownShell is returned.
no setter