let data = Data(...)
+let data = Data(...)
writer.write(data: data)
reader.readSomeData()
reader.readData()
-Commands
+Commands
-All Contexts (CustomContext and main) implement CommandRunning, which means they can run commands using themselves as the Context. ReadableStream and String can also run commands, they use main as the Context and themselves as .stdin. As a shortcut you can just use run(...) instead of main.run(...)
+All Contexts (CustomContext and main) implement CommandRunning, which means they can run commands using themselves as the Context. ReadableStream and String can also run commands, they use main as the Context and themselves as .stdin. As a shortcut you can just use run(...) instead of main.run(...)
There are three different ways of running a command:
-Run
+Run
The simplest is to just run the command, wait until it’s finished and return the results:
let result1 = run("/usr/bin/executable", "argument1", "argument2")
@@ -418,7 +424,7 @@ The path to the application.
run returns the following information:
/// Output from a `run` command.
-public final class RunOutput {
+public final class RunOutput {
/// The error from running the command, if any.
let error: CommandError?
@@ -441,18 +447,18 @@ The path to the application.
let date = run("date", "-u").stdout
print("Today's date in UTC is " + date)
-Print output
+Print output
try runAndPrint("executable", "arg")
-This runs a command like in the terminal, where any output goes to the Context’s (main in this case) .stdout and .stderror respectively. If the executable could not be found, was inaccessible or not executable, or the command returned with an exit code other than zero, then runAndPrint will throw a CommandError.
+This runs a command like in the terminal, where any output goes to the Context’s (main in this case) .stdout and .stderror respectively. If the executable could not be found, was inaccessible or not executable, or the command returned with an exit code other than zero, then runAndPrint will throw a CommandError.
The name may seem a bit cumbersome, but it explains exactly what it does. SwiftShell never prints anything without explicitly being told to.
-Asynchronous
-let command = runAsync("cmd", "-n", 245).onCompletion { command in
+Asynchronous
+let command = runAsync("cmd", "-n", 245).onCompletion { command in
// be notified when the command is finished.
}
-command.stdout.onOutput { stdout in
+command.stdout.onOutput { stdout in
// be notified when the command produces output.
}
@@ -463,7 +469,7 @@ The path to the application.
runAsync launches a command and continues before it’s finished. It returns this:
/// Output from the 'runAsync' methods.
-public final class AsyncCommand {
+public final class AsyncCommand {
public let stdout: ReadableStream
public let stderror: ReadableStream
@@ -491,10 +497,10 @@ The path to the application.
You can process standard output and standard error, and optionally wait until it’s finished and handle any errors.
If you read all of command.stderror or command.stdout it will automatically wait for the command to close its streams (and presumably finish running). You can still call finish() to check for errors.
-Parameters
+Parameters
The 3 run functions above take 2 different types of parameters:
-(_ executable: String, _ args: Any …)
+(_ executable: String, _ args: Any …)
If the path to the executable is without any /, SwiftShell will try to find the full path using the which shell command, which searches the directories in the PATH environment variable in order.
@@ -506,7 +512,7 @@ The path to the application.
try runAndPrint("echo", array, array.count + 2, "arguments")
// echo But we are 5 arguments
-(bash bashcommand: String)
+(bash bashcommand: String)
These are the commands you normally use in the Terminal. You can use pipes and redirection and all that good stuff:
try runAndPrint(bash: "cmd1 arg1 | cmd2 > output.txt")
@@ -516,85 +522,73 @@ The path to the application.
var file = try open(forWriting: "output.txt")
runAsync("cmd1", "arg1").stdout.runAsync("cmd2").stdout.write(to: &file)
-Errors
+Errors
If the command provided to runAsync could not be launched for any reason the program will print the error to standard error and exit, as is usual in scripts. The runAsync("cmd").finish() method throws an error if the exit code of the command is anything but 0:
let command = runAsync("cmd", "-n", 245)
// do something with command.stderror or command.stdoutCommandError
-do {
+do {
try command.finish()
-} catch CommandError.ReturnedErrorCode(let error) {
+} catch CommandError.ReturnedErrorCode(let error) {
// use error.command or error.errorcode
}
The runAndPrint command can also throw this error, in addition to this one if the command could not be launched:
-} catch CommandError.InAccessibleExecutable(let path) {
+} catch CommandError.InAccessibleExecutable(let path) {
// ‘path’ is the full path to the executable
}
Instead of dealing with the values from these errors you can just print them:
-} catch {
+} catch {
print(error)
}
… or if they are sufficiently serious you can print them to standard error and exit:
-} catch {
+} catch {
exit(error)
}
When at the top code level you don’t need to catch any errors, but you still have to use try.
-Setup
-
-One of the goals of SwiftShell is to be able to run single .swift files directly, like you do with bash and Python files. This is possible now, but every time you upgrade Xcode or Swift you have to recompile all the third party frameworks your Swift script files use (including the SwiftShell framework). This will continue to be a problem until Swift achieves ABI stability in (hopefully) version 5. For now it is more practical to precompile the script into a self-contained executable.
-Pre-compiled executable
+Setup
+Stand-alone project
If you put Misc/swiftshell-init somewhere in your $PATH you can create a new project with swiftshell-init <name>. This creates a new folder, initialises a Swift Package Manager executable folder structure, downloads the latest version of SwiftShell, creates an Xcode project and opens it. After running swift build you can find the compiled executable at .build/debug/<name>.
-Shell script
+
-
-- In the Terminal, go to where you want to download SwiftShell.
-Run
-git clone https://github.com/kareman/SwiftShell.git
-cd SwiftShell
-
-Copy/link Misc/swiftshell to your bin folder or anywhere in your PATH.
-To install the framework itself, run xcodebuild and copy the resulting framework from the build folder to your library folder of choice. If that is not ~/Library/Frameworks
or /Library/Frameworks
then make sure the folder is listed in $SWIFTSHELL_FRAMEWORK_PATH.
-
-
-Then include this in the beginning of each script:
-#!/usr/bin/env swiftshell
-
-import SwiftShell
+First add SwiftShell to Marathon:
+marathon add https://github.com/kareman/SwiftShell.git
-
-Add .Package(url: "https://github.com/kareman/SwiftShell", "3.0.0-beta") to your Package.swift:
+Then run your Swift scripts with marathon run <name>.swift. Or add #!/usr/bin/env marathon run to the top of every script file and run them with ./<name>.swift.
+
+
+Add .Package(url: "https://github.com/kareman/SwiftShell", majorVersion: 4) to your Package.swift:
import PackageDescription
-let package = Package(
+let package = Package(
name: "somecommandlineapp",
dependencies: [
- .Package(url: "https://github.com/kareman/SwiftShell.git", "3.0.0-beta")
+ .Package(url: "https://github.com/kareman/SwiftShell.git", majorVersion: 4)
]
)
and run swift build.
-
+
-Add github "kareman/SwiftShell" "master" to your Cartfile, then run carthage update and add the resulting framework to the Embedded Binaries
section of the application. See Carthage’s README for further instructions.
-
+Add github "kareman/SwiftShell" >= 4.0 to your Cartfile, then run carthage update and add the resulting framework to the Embedded Binaries
section of the application. See Carthage’s README for further instructions.
+
Add SwiftShell to your Podfile.
-pod 'SwiftShell', '>= 3.0.0-beta'
+pod 'SwiftShell', '>= 4.0.0'
Then run pod install to install it.
-License
+License
Released under the MIT License (MIT), http://opensource.org/licenses/MIT
@@ -603,8 +597,8 @@ cd SwiftShell
diff --git a/js/jazzy.js b/js/jazzy.js
index 4ff9455..3965b5f 100755
--- a/js/jazzy.js
+++ b/js/jazzy.js
@@ -38,3 +38,9 @@ $(".token").click(function(event) {
}
event.preventDefault();
});
+
+// Dumb down quotes within code blocks that delimit strings instead of quotations
+// https://github.com/realm/jazzy/issues/714
+$("code q").replaceWith(function () {
+ return ["\"", $(this).contents(), "\""];
+});
diff --git a/search.json b/search.json
new file mode 100644
index 0000000..aedd2af
--- /dev/null
+++ b/search.json
@@ -0,0 +1 @@
+{"Structs/PartialSourceLazySplitSequence.html#/s:10SwiftShell30PartialSourceLazySplitSequenceVACyxGxSgyc_7ElementQz9separatortcfc":{"name":"init(_:separator:)","abstract":"Creates a lazy sequence by splitting a series of collections repeatedly, as if they were one collection.
","parent_name":"PartialSourceLazySplitSequence"},"Structs/PartialSourceLazySplitSequence.html#/s:10SwiftShell30PartialSourceLazySplitSequenceV4next03SubG0QzSgyF":{"name":"next()","abstract":"The contents of ‘bases’ up to the next occurrence of ‘separator’.
","parent_name":"PartialSourceLazySplitSequence"},"Structs/LazySplitSequence.html#/s:10SwiftShell17LazySplitSequenceV9remaining03SubE0QzSgv":{"name":"remaining","abstract":"Undocumented
","parent_name":"LazySplitSequence"},"Structs/LazySplitSequence.html#/s:10SwiftShell17LazySplitSequenceV9separator7ElementQzv":{"name":"separator","abstract":"Undocumented
","parent_name":"LazySplitSequence"},"Structs/LazySplitSequence.html#/s:10SwiftShell17LazySplitSequenceV16allowEmptySlicesSbv":{"name":"allowEmptySlices","abstract":"Undocumented
","parent_name":"LazySplitSequence"},"Structs/LazySplitSequence.html#/s:10SwiftShell17LazySplitSequenceVACyxGx_7ElementQz9separatorSb16allowEmptySlicestcfc":{"name":"init(_:separator:allowEmptySlices:)","abstract":"Creates a lazy sequence by splitting a Collection repeatedly.
","parent_name":"LazySplitSequence"},"Structs/LazySplitSequence.html#/s:10SwiftShell17LazySplitSequenceV4next03SubE0QzSgyF":{"name":"next()","abstract":"The contents of ‘base’ up to the next occurrence of ‘separator’.
","parent_name":"LazySplitSequence"},"Structs/CustomContext.html#/s:10SwiftShell13CustomContextV3envs10DictionaryVyS2SGv":{"name":"env","abstract":"Undocumented
","parent_name":"CustomContext"},"Structs/CustomContext.html#/s:10SwiftShell13CustomContextV5stdinAA14ReadableStream_pv":{"name":"stdin","abstract":"Undocumented
","parent_name":"CustomContext"},"Structs/CustomContext.html#/s:10SwiftShell13CustomContextV6stdoutAA14WritableStream_pv":{"name":"stdout","abstract":"Undocumented
","parent_name":"CustomContext"},"Structs/CustomContext.html#/s:10SwiftShell13CustomContextV8stderrorAA14WritableStream_pv":{"name":"stderror","abstract":"Undocumented
","parent_name":"CustomContext"},"Structs/CustomContext.html#/s:10SwiftShell13CustomContextV16currentdirectorySSv":{"name":"currentdirectory","abstract":"The current working directory.
","parent_name":"CustomContext"},"Structs/CustomContext.html#/s:10SwiftShell13CustomContextVACycfc":{"name":"init()","abstract":"Creates a blank CustomContext where env and stdin are empty, stdout and stderror discard everything and","parent_name":"CustomContext"},"Structs/CustomContext.html#/s:10SwiftShell13CustomContextVAcA0D0_pcfc":{"name":"init(_:)","abstract":"
Creates an identical copy of another Context.
","parent_name":"CustomContext"},"Structs/CustomContext.html":{"name":"CustomContext","abstract":"Undocumented
"},"Structs/LazySplitSequence.html":{"name":"LazySplitSequence","abstract":"A sequence from splitting a Collection lazily.
"},"Structs/PartialSourceLazySplitSequence.html":{"name":"PartialSourceLazySplitSequence","abstract":"A sequence from splitting a series of Collections lazily, as if they were one Collection.
"},"Protocols/WritableStream.html#/s:10SwiftShell14WritableStreamP8encodingSS10FoundationE8EncodingVv":{"name":"encoding","abstract":"Undocumented
","parent_name":"WritableStream"},"Protocols/WritableStream.html#/s:10SwiftShell14WritableStreamP10filehandleSo10FileHandleCv":{"name":"filehandle","abstract":"Undocumented
","parent_name":"WritableStream"},"Protocols/WritableStream.html#/s:10SwiftShell14WritableStreamP5writeySSF":{"name":"write(_:)","abstract":"Writes x to the stream.
","parent_name":"WritableStream"},"Protocols/WritableStream.html#/s:10SwiftShell14WritableStreamP5closeyyF":{"name":"close()","abstract":"Closes the stream. Must be called on non-file streams when finished writing,","parent_name":"WritableStream"},"Protocols/WritableStream.html#/s:10SwiftShell14WritableStreamPAAE5printySayypGd_SS9separatorSS10terminatortF":{"name":"print(_:separator:terminator:)","abstract":"
Writes the textual representations of the given items into the stream.","parent_name":"WritableStream"},"Protocols/WritableStream.html#/s:10SwiftShell14WritableStreamPAAE5writey10Foundation4DataV4data_tF":{"name":"write(data:)","abstract":"
Writes data to the stream.
","parent_name":"WritableStream"},"Protocols/ReadableStream.html#/s:10SwiftShell14ReadableStreamP8encodingSS10FoundationE8EncodingVv":{"name":"encoding","abstract":"Undocumented
","parent_name":"ReadableStream"},"Protocols/ReadableStream.html#/s:10SwiftShell14ReadableStreamP10filehandleSo10FileHandleCv":{"name":"filehandle","abstract":"Undocumented
","parent_name":"ReadableStream"},"Protocols/ReadableStream.html#/s:10SwiftShell14ReadableStreamP8readSomeSSSgyF":{"name":"readSome()","abstract":"All the text the stream contains so far.","parent_name":"ReadableStream"},"Protocols/ReadableStream.html#/s:10SwiftShell14ReadableStreamP4readSSyF":{"name":"read()","abstract":"
Reads everything at once.
","parent_name":"ReadableStream"},"Protocols/ReadableStream.html#/s:10SwiftShell14ReadableStreamPAAE5liness12LazySequenceVys03AnyG0VySSGGyF":{"name":"lines()","abstract":"Splits stream lazily into lines.
","parent_name":"ReadableStream"},"Protocols/ReadableStream.html#/s:10SwiftShell14ReadableStreamPAAE5writeyqd__z2to_ts010TextOutputD0Rd__lF":{"name":"write(to:)","abstract":"Writes the text in this stream to the given TextOutputStream.
","parent_name":"ReadableStream"},"Protocols/ReadableStream.html#/s:10SwiftShell14ReadableStreamPAAE5writeyAA08WritableD0_pz2to_tF":{"name":"write(to:)","abstract":"Writes the text in this stream to the given WritableStream.
","parent_name":"ReadableStream"},"Protocols/ReadableStream.html#/s:10SwiftShell14ReadableStreamPAAE7contextAA7Context_pv":{"name":"context","abstract":"Undocumented
","parent_name":"ReadableStream"},"Protocols/ReadableStream.html#/s:10SwiftShell14ReadableStreamPAAE12readSomeData10Foundation0G0VSgyF":{"name":"readSomeData()","abstract":"All the data the stream contains so far.","parent_name":"ReadableStream"},"Protocols/ReadableStream.html#/s:10SwiftShell14ReadableStreamPAAE8readData10Foundation0F0VyF":{"name":"readData()","abstract":"
Reads everything at once.
","parent_name":"ReadableStream"},"Protocols/ReadableStream.html#/s:10SwiftShell14ReadableStreamPAAE8onOutputyyAaB_pcF":{"name":"onOutput(_:)","abstract":"handler will be called whenever there is new output available.
","parent_name":"ReadableStream"},"Protocols/ReadableStream.html#/s:10SwiftShell14ReadableStreamPAAE14onStringOutputyySScF":{"name":"onStringOutput(_:)","abstract":"handler will be called whenever there is new text output available.
","parent_name":"ReadableStream"},"Protocols/Context.html#/s:10SwiftShell7ContextP3envs10DictionaryVyS2SGv":{"name":"env","abstract":"Undocumented
","parent_name":"Context"},"Protocols/Context.html#/s:10SwiftShell7ContextP5stdinAA14ReadableStream_pv":{"name":"stdin","abstract":"Undocumented
","parent_name":"Context"},"Protocols/Context.html#/s:10SwiftShell7ContextP6stdoutAA14WritableStream_pv":{"name":"stdout","abstract":"Undocumented
","parent_name":"Context"},"Protocols/Context.html#/s:10SwiftShell7ContextP8stderrorAA14WritableStream_pv":{"name":"stderror","abstract":"Undocumented
","parent_name":"Context"},"Protocols/Context.html#/s:10SwiftShell7ContextP16currentdirectorySSv":{"name":"currentdirectory","abstract":"The current working directory.
","parent_name":"Context"},"Protocols/Context.html#/s:10SwiftShell7ContextPAAE16debugDescriptionSSv":{"name":"debugDescription","abstract":"A textual representation of this instance, suitable for debugging.
","parent_name":"Context"},"Protocols/CommandRunning.html#/s:10SwiftShell14CommandRunningP7contextAA7Context_pv":{"name":"context","abstract":"Undocumented
","parent_name":"CommandRunning"},"Protocols/CommandRunning.html#/s:10SwiftShell14CommandRunningPAAE3runAA9RunOutputCSS4bash_Sb07combineG0tF":{"name":"run(bash:combineOutput:)","abstract":"Runs a bash shell command.
","parent_name":"CommandRunning"},"Protocols/CommandRunning.html#/s:10SwiftShell14CommandRunningPAAE8runAsyncAA0fC0CSS4bash_SS4fileSi4linetF":{"name":"runAsync(bash:file:line:)","abstract":"Run bash command and return before it is finished.
","parent_name":"CommandRunning"},"Protocols/CommandRunning.html#/s:10SwiftShell14CommandRunningPAAE11runAndPrintySS4bash_tKF":{"name":"runAndPrint(bash:)","abstract":"Run bash command and print output and errors.
","parent_name":"CommandRunning"},"Protocols/CommandRunning.html#/s:10SwiftShell14CommandRunningPAAE3runAA9RunOutputCSS_SayypGdSb07combineG0tF":{"name":"run(_:_:combineOutput:)","abstract":"Runs a command.
","parent_name":"CommandRunning"},"Protocols/CommandRunning.html#/s:10SwiftShell14CommandRunningPAAE8runAsyncAA0fC0CSS_SayypGdSS4fileSi4linetF":{"name":"runAsync(_:_:file:line:)","abstract":"Run executable and return before it is finished.
","parent_name":"CommandRunning"},"Protocols/CommandRunning.html#/s:10SwiftShell14CommandRunningPAAE11runAndPrintySS_SayypGdtKF":{"name":"runAndPrint(_:_:)","abstract":"Run executable and print output and errors.
","parent_name":"CommandRunning"},"Protocols/CommandRunning.html":{"name":"CommandRunning","abstract":"Can run commands.
"},"Protocols/Context.html":{"name":"Context","abstract":"Undocumented
"},"Protocols.html#/CommandRunning":{"name":"CommandRunning","abstract":"CommandRunning is not available on iOS, tvOS and watchOS.
"},"Protocols/ReadableStream.html":{"name":"ReadableStream","abstract":"A stream of text. Does as much as possible lazily.
"},"Protocols/WritableStream.html":{"name":"WritableStream","abstract":"An output stream, like standard output or a writeable file.
"},"Functions.html#/s:10SwiftShell3runAA9RunOutputCSS4bash_Sb07combineE0tF":{"name":"run(bash:combineOutput:)","abstract":"Runs a bash shell command.
"},"Functions.html#/s:10SwiftShell8runAsyncAA0D7CommandCSS4bash_SS4fileSi4linetF":{"name":"runAsync(bash:file:line:)","abstract":"Run bash command and return before it is finished.
"},"Functions.html#/s:10SwiftShell11runAndPrintySS4bash_tKF":{"name":"runAndPrint(bash:)","abstract":"Run bash command and print output and errors.
"},"Functions.html#/s:10SwiftShell4exits5NeverOx12errormessage_Si9errorcodeSS4fileSi4linetlF":{"name":"exit(errormessage:errorcode:file:line:)","abstract":"Print message to standard error and halt execution.
"},"Functions.html#/s:10SwiftShell4exits5NeverOs5Error_p_SS4fileSi4linetF":{"name":"exit(_:file:line:)","abstract":"Print error to standard error and halt execution.
"},"Functions.html#/s:10SwiftShell2eeoiSbAA12CommandErrorO_ADtF":{"name":"==(_:_:)","abstract":"Undocumented
"},"Functions.html#/s:10SwiftShell3runAA9RunOutputCSS_SayypGdSb07combineE0tF":{"name":"run(_:_:combineOutput:)","abstract":"Runs a command.
"},"Functions.html#/s:10SwiftShell8runAsyncAA0D7CommandCSS_SayypGdSS4fileSi4linetF":{"name":"runAsync(_:_:file:line:)","abstract":"Run executable and return before it is finished.
"},"Functions.html#/s:10SwiftShell11runAndPrintySS_SayypGdtKF":{"name":"runAndPrint(_:_:)","abstract":"Run executable and print output and errors.
"},"Functions.html#/s:10SwiftShell1poi10Foundation3URLVAE_SStF":{"name":"+(_:_:)","abstract":"Append file or directory url to directory url
"},"Functions.html#/s:10SwiftShell4openAA14ReadableStream_pSS_SS10FoundationE8EncodingV8encodingtKF":{"name":"open(_:encoding:)","abstract":"Open a file for reading, throw if an error occurs.
"},"Functions.html#/s:10SwiftShell4openAA14ReadableStream_p10Foundation3URLV_SSADE8EncodingV8encodingtKF":{"name":"open(_:encoding:)","abstract":"Open a file for reading, throw if an error occurs.
"},"Functions.html#/s:10SwiftShell4openAA14WritableStream_p10Foundation3URLV10forWriting_Sb9overwriteSSADE8EncodingV8encodingtKF":{"name":"open(forWriting:overwrite:encoding:)","abstract":"Open a file for writing, create it first if it doesn’t exist."},"Functions.html#/s:10SwiftShell4openAA14WritableStream_pSS10forWriting_Sb9overwriteSS10FoundationE8EncodingV8encodingtKF":{"name":"open(forWriting:overwrite:encoding:)","abstract":"
Open a file for writing, create it first if it doesn’t exist."},"Functions.html#/s:10SwiftShell7streamsAA14WritableStream_p_AA08ReadableE0_ptyF":{"name":"streams()","abstract":"
Creates a pair of streams. What is written to the 1st one can be read from the 2nd one.
"},"Extensions/String.html#/s:SS10SwiftShellE7contextAA7Context_pv":{"name":"context","abstract":"Undocumented
","parent_name":"String"},"Extensions/String.html#/s:SS10SwiftShellE5linesSaySSGyF":{"name":"lines()","abstract":"Split text into lines (as separated by newlines).
","parent_name":"String"},"Extensions/LazyCollectionProtocol.html#/s:s22LazyCollectionProtocolP10SwiftShellsAARzs9Equatable7ElementRpzs0B08Elements_11SubSequenceRPzlE5splitAC0a5SplitJ0VyAHQzGAF9separator_Sb16allowEmptySlicestF":{"name":"split(separator:allowEmptySlices:)","abstract":"Creates a lazy sequence by splitting this Collection repeatedly.
","parent_name":"LazyCollectionProtocol"},"Extensions/FileHandle.html#/nullDev":{"name":"nullDev","abstract":"Returns ’/dev/null’. ‘nullDevice’ has not been implemented yet in Swift Foundation.
","parent_name":"FileHandle"},"Extensions/FileHandle.html#/s:So10FileHandleC10SwiftShellE7nullDevABvZ":{"name":"nullDev","abstract":"Returns ’.nullDevice’. ‘nullDevice’ has not been implemented yet in Swift Foundation.
","parent_name":"FileHandle"},"Extensions/FileHandle.html#/s:So10FileHandleC10SwiftShellE8readSomeSSSgSS10FoundationE8EncodingV8encoding_tF":{"name":"readSome(encoding:)","abstract":"Read what is available, as a String.
","parent_name":"FileHandle"},"Extensions/FileHandle.html#/s:So10FileHandleC10SwiftShellE4readS2S10FoundationE8EncodingV8encoding_tF":{"name":"read(encoding:)","abstract":"Read to the end, as a String.
","parent_name":"FileHandle"},"Extensions/FileHandle.html#/s:So10FileHandleC10SwiftShellE5writeySS_SS10FoundationE8EncodingV8encodingtF":{"name":"write(_:encoding:)","abstract":"Undocumented
","parent_name":"FileHandle"},"Extensions/Process.html#/s:So7ProcessC10SwiftShellE15launchThrowablyyyKF":{"name":"launchThrowably()","abstract":"Launch process.
","parent_name":"Process"},"Extensions/Process.html#/s:So7ProcessC10SwiftShellE6finishyyKF":{"name":"finish()","abstract":"Wait until process is finished.
","parent_name":"Process"},"Extensions/Process.html":{"name":"Process"},"Extensions/FileHandle.html":{"name":"FileHandle"},"Extensions/LazyCollectionProtocol.html":{"name":"LazyCollectionProtocol"},"Extensions/String.html":{"name":"String","abstract":"Let Strings run commands using itself as stdin.
"},"Enums/FileError.html#/s:10SwiftShell9FileErrorO8notFoundACSS4path_tcACmF":{"name":"notFound","abstract":"Undocumented
","parent_name":"FileError"},"Enums/FileError.html#/s:10SwiftShell9FileErrorO05checkC0ySSKFZ":{"name":"checkFile(_:)","abstract":"Undocumented
","parent_name":"FileError"},"Enums/FileError.html#/s:s23CustomStringConvertibleP11descriptionSSv":{"name":"description","parent_name":"FileError"},"Enums/CommandError.html#/s:10SwiftShell12CommandErrorO08returnedD4CodeACSS7command_Si9errorcodetcACmF":{"name":"returnedErrorCode","abstract":"Exit code was not zero.
","parent_name":"CommandError"},"Enums/CommandError.html#/s:10SwiftShell12CommandErrorO22inAccessibleExecutableACSS4path_tcACmF":{"name":"inAccessibleExecutable","abstract":"Command could not be executed.
","parent_name":"CommandError"},"Enums/CommandError.html#/s:10SwiftShell12CommandErrorO9errorcodeSiv":{"name":"errorcode","abstract":"Exit code for this error.
","parent_name":"CommandError"},"Enums/CommandError.html#/s:s23CustomStringConvertibleP11descriptionSSv":{"name":"description","parent_name":"CommandError"},"Enums/CommandError.html":{"name":"CommandError","abstract":"Error type for commands.
"},"Enums/FileError.html":{"name":"FileError","abstract":"Error type for file commands.
"},"Global Variables.html#/s:10SwiftShell4mainAA11MainContextCv":{"name":"main","abstract":"Undocumented
"},"Global Variables.html#/s:10SwiftShell5FilesSo11FileManagerCv":{"name":"Files","abstract":"The default FileManager
"},"Classes/FileHandleStream.html#/s:10SwiftShell16FileHandleStreamC10filehandleSo0cD0Cv":{"name":"filehandle","abstract":"Undocumented
","parent_name":"FileHandleStream"},"Classes/FileHandleStream.html#/s:10SwiftShell16FileHandleStreamC8encodingSS10FoundationE8EncodingVv":{"name":"encoding","abstract":"Undocumented
","parent_name":"FileHandleStream"},"Classes/FileHandleStream.html#/s:10SwiftShell16FileHandleStreamCACSo0cD0C_SS10FoundationE8EncodingV8encodingtcfc":{"name":"init(_:encoding:)","abstract":"Undocumented
","parent_name":"FileHandleStream"},"Classes/StdoutStream.html#/s:10SwiftShell12StdoutStreamC8encodingSS10FoundationE8EncodingVv":{"name":"encoding","abstract":"Undocumented
","parent_name":"StdoutStream"},"Classes/StdoutStream.html#/s:10SwiftShell12StdoutStreamC10filehandleSo10FileHandleCv":{"name":"filehandle","abstract":"Undocumented
","parent_name":"StdoutStream"},"Classes/StdoutStream.html#/s:10SwiftShell12StdoutStreamC7defaultACvZ":{"name":"default","abstract":"Undocumented
","parent_name":"StdoutStream"},"Classes/StdoutStream.html#/s:10SwiftShell14WritableStreamP5writeySSF":{"name":"write(_:)","parent_name":"StdoutStream"},"Classes/StdoutStream.html#/s:10SwiftShell14WritableStreamP5closeyyF":{"name":"close()","parent_name":"StdoutStream"},"Classes/Signals/Signal.html#/s:10SwiftShell7SignalsC6SignalO3hupA2EmF":{"name":"hup","abstract":"Undocumented
","parent_name":"Signal"},"Classes/Signals/Signal.html#/s:10SwiftShell7SignalsC6SignalO3intA2EmF":{"name":"int","abstract":"Undocumented
","parent_name":"Signal"},"Classes/Signals/Signal.html#/s:10SwiftShell7SignalsC6SignalO4quitA2EmF":{"name":"quit","abstract":"Undocumented
","parent_name":"Signal"},"Classes/Signals/Signal.html#/s:10SwiftShell7SignalsC6SignalO4abrtA2EmF":{"name":"abrt","abstract":"Undocumented
","parent_name":"Signal"},"Classes/Signals/Signal.html#/s:10SwiftShell7SignalsC6SignalO4killA2EmF":{"name":"kill","abstract":"Undocumented
","parent_name":"Signal"},"Classes/Signals/Signal.html#/s:10SwiftShell7SignalsC6SignalO4alrmA2EmF":{"name":"alrm","abstract":"Undocumented
","parent_name":"Signal"},"Classes/Signals/Signal.html#/s:10SwiftShell7SignalsC6SignalO4termA2EmF":{"name":"term","abstract":"Undocumented
","parent_name":"Signal"},"Classes/Signals/Signal.html#/s:10SwiftShell7SignalsC6SignalO4pipeA2EmF":{"name":"pipe","abstract":"Undocumented
","parent_name":"Signal"},"Classes/Signals/Signal.html#/s:10SwiftShell7SignalsC6SignalO4userAESicAEmF":{"name":"user","abstract":"Undocumented
","parent_name":"Signal"},"Classes/Signals/Signal.html#/s:10SwiftShell7SignalsC6SignalO7valueOfs5Int32Vv":{"name":"valueOf","abstract":"Obtain the OS dependent value of a Signal
","parent_name":"Signal"},"Classes/Signals/Signal.html":{"name":"Signal","abstract":"Common OS Signals
","parent_name":"Signals"},"Classes/Signals.html#/s:10SwiftShell7SignalsC16SigActionHandlera":{"name":"SigActionHandler","abstract":"Action handler signature.
","parent_name":"Signals"},"Classes/Signals.html#/s:10SwiftShell7SignalsC4trapyAC6SignalO6signal_ys5Int32VXC6actiontFZ":{"name":"trap(signal:action:)","abstract":"Trap an operating system signal.
","parent_name":"Signals"},"Classes/Signals.html#/s:10SwiftShell7SignalsC4trapySayAC6SignalO6signal_ys5Int32VXC6actiontG7signals_tFZ":{"name":"trap(signals:)","abstract":"Trap multiple signals to individual handlers
","parent_name":"Signals"},"Classes/Signals.html#/s:10SwiftShell7SignalsC4trapySayAC6SignalOG7signals_ys5Int32VXC6actiontFZ":{"name":"trap(signals:action:)","abstract":"Trap multiple signals to a single handler
","parent_name":"Signals"},"Classes/Signals.html#/s:10SwiftShell7SignalsC5raiseyAC6SignalO6signal_tFZ":{"name":"raise(signal:)","abstract":"Raise an operating system signal
","parent_name":"Signals"},"Classes/Signals.html#/s:10SwiftShell7SignalsC6ignoreyAC6SignalO6signal_tFZ":{"name":"ignore(signal:)","abstract":"Ignore a signal
","parent_name":"Signals"},"Classes/Signals.html#/s:10SwiftShell7SignalsC7restoreyAC6SignalO6signal_tFZ":{"name":"restore(signal:)","abstract":"Restore default signal handling
","parent_name":"Signals"},"Classes/MainContext.html#/s:10SwiftShell11MainContextC8encodingSS10FoundationE8EncodingVv":{"name":"encoding","abstract":"The default character encoding used throughout SwiftShell.
","parent_name":"MainContext"},"Classes/MainContext.html#/s:10SwiftShell11MainContextC3envs10DictionaryVyS2SGv":{"name":"env","abstract":"Undocumented
","parent_name":"MainContext"},"Classes/MainContext.html#/s:10SwiftShell11MainContextC5stdinAA14ReadableStream_pv":{"name":"stdin","abstract":"Undocumented
","parent_name":"MainContext"},"Classes/MainContext.html#/s:10SwiftShell11MainContextC6stdoutAA14WritableStream_pv":{"name":"stdout","abstract":"Undocumented
","parent_name":"MainContext"},"Classes/MainContext.html#/s:10SwiftShell11MainContextC8stderrorAA14WritableStream_pv":{"name":"stderror","abstract":"Undocumented
","parent_name":"MainContext"},"Classes/MainContext.html#/s:10SwiftShell11MainContextC16currentdirectorySSv":{"name":"currentdirectory","abstract":"The current working directory.
","parent_name":"MainContext"},"Classes/MainContext.html#/s:10SwiftShell11MainContextC13tempdirectorySSv":{"name":"tempdirectory","abstract":"The tempdirectory is unique each time a script is run and is created the first time it is used.","parent_name":"MainContext"},"Classes/MainContext.html#/s:10SwiftShell11MainContextC9argumentsSaySSGv":{"name":"arguments","abstract":"
The arguments this executable was launched with. Use main.path to get the path.
","parent_name":"MainContext"},"Classes/MainContext.html#/s:10SwiftShell11MainContextC4pathSSv":{"name":"path","abstract":"The path to the currently running executable. Will be empty in playgrounds.
","parent_name":"MainContext"},"Classes/AsyncCommand.html#/s:10SwiftShell12AsyncCommandC6stdoutAA14ReadableStream_pv":{"name":"stdout","abstract":"Undocumented
","parent_name":"AsyncCommand"},"Classes/AsyncCommand.html#/s:10SwiftShell12AsyncCommandC8stderrorAA14ReadableStream_pv":{"name":"stderror","abstract":"Undocumented
","parent_name":"AsyncCommand"},"Classes/AsyncCommand.html#/s:10SwiftShell12AsyncCommandC9isRunningSbv":{"name":"isRunning","abstract":"Is the command still running?
","parent_name":"AsyncCommand"},"Classes/AsyncCommand.html#/s:10SwiftShell12AsyncCommandC4stopyyF":{"name":"stop()","abstract":"Terminates command.
","parent_name":"AsyncCommand"},"Classes/AsyncCommand.html#/s:10SwiftShell12AsyncCommandC6finishACyKF":{"name":"finish()","abstract":"Wait for this command to finish.
","parent_name":"AsyncCommand"},"Classes/AsyncCommand.html#/s:10SwiftShell12AsyncCommandC8exitcodeSiyF":{"name":"exitcode()","abstract":"Wait for command to finish, then return with exit code.
","parent_name":"AsyncCommand"},"Classes/AsyncCommand.html#/s:10SwiftShell12AsyncCommandC12onCompletionACyACcF":{"name":"onCompletion(_:)","abstract":"Takes a closure to be called when the command has finished.
","parent_name":"AsyncCommand"},"Classes/RunOutput.html#/s:10SwiftShell9RunOutputC5errorAA12CommandErrorOSgv":{"name":"error","abstract":"The error from running the command, if any.
","parent_name":"RunOutput"},"Classes/RunOutput.html#/s:10SwiftShell9RunOutputC6stdoutSSv":{"name":"stdout","abstract":"Standard output, trimmed for whitespace and newline if it is single-line.
","parent_name":"RunOutput"},"Classes/RunOutput.html#/s:10SwiftShell9RunOutputC8stderrorSSv":{"name":"stderror","abstract":"Standard error, trimmed for whitespace and newline if it is single-line.
","parent_name":"RunOutput"},"Classes/RunOutput.html#/s:10SwiftShell9RunOutputC8exitcodeSiv":{"name":"exitcode","abstract":"The exit code of the command. Anything but 0 means there was an error.
","parent_name":"RunOutput"},"Classes/RunOutput.html#/s:10SwiftShell9RunOutputC9succeededSbv":{"name":"succeeded","abstract":"Checks if the exit code is 0.
","parent_name":"RunOutput"},"Classes/RunOutput.html#/s:10SwiftShell9RunOutputC2aaoiA2C_ACyXKtFZ":{"name":"&&(_:_:)","abstract":"Run the first command, then the second one only if the first succeeded.
","parent_name":"RunOutput"},"Classes/RunOutput.html#/s:10SwiftShell9RunOutputC2oooiA2C_ACyXKtFZ":{"name":"||(_:_:)","abstract":"Run the first command, then the second one only if the first failed.
","parent_name":"RunOutput"},"Classes/RunOutput.html":{"name":"RunOutput","abstract":"Output from a run command.
"},"Classes/AsyncCommand.html":{"name":"AsyncCommand","abstract":"Output from the ‘runAsync’ methods.
"},"Classes/MainContext.html":{"name":"MainContext","abstract":"Undocumented
"},"Classes/Signals.html":{"name":"Signals","abstract":"Undocumented
"},"Classes/StdoutStream.html":{"name":"StdoutStream","abstract":"Singleton WritableStream used only for printing to stdout.
"},"Classes/FileHandleStream.html":{"name":"FileHandleStream","abstract":"Undocumented
"},"Classes.html":{"name":"Classes","abstract":"The following classes are available globally.
"},"Global Variables.html":{"name":"Global Variables","abstract":"The following global variables are available globally.
"},"Enums.html":{"name":"Enumerations","abstract":"The following enumerations are available globally.
"},"Extensions.html":{"name":"Extensions","abstract":"The following extensions are available globally.
"},"Functions.html":{"name":"Functions","abstract":"The following functions are available globally.
"},"Protocols.html":{"name":"Protocols","abstract":"The following protocols are available globally.
"},"Structs.html":{"name":"Structures","abstract":"The following structures are available globally.
"}}
\ No newline at end of file
diff --git a/undocumented.json b/undocumented.json
index ace042c..920c238 100644
--- a/undocumented.json
+++ b/undocumented.json
@@ -2,35 +2,35 @@
"warnings": [
{
"file": "/Users/karemorstol/Programming/SwiftShell/SwiftShell3/Sources/SwiftShell/Command.swift",
- "line": 48,
+ "line": 74,
"symbol": "CommandRunning.context",
"symbol_kind": "source.lang.swift.decl.var.instance",
"warning": "undocumented"
},
{
"file": "/Users/karemorstol/Programming/SwiftShell/SwiftShell3/Sources/SwiftShell/Command.swift",
- "line": 52,
+ "line": 78,
"symbol": "CommandRunning.context",
"symbol_kind": "source.lang.swift.decl.var.instance",
"warning": "undocumented"
},
{
"file": "/Users/karemorstol/Programming/SwiftShell/SwiftShell3/Sources/SwiftShell/Command.swift",
- "line": 119,
+ "line": 145,
"symbol": "==(_:_:)",
"symbol_kind": "source.lang.swift.decl.function.free",
"warning": "undocumented"
},
{
"file": "/Users/karemorstol/Programming/SwiftShell/SwiftShell3/Sources/SwiftShell/Command.swift",
- "line": 259,
+ "line": 278,
"symbol": "AsyncCommand.stdout",
"symbol_kind": "source.lang.swift.decl.var.instance",
"warning": "undocumented"
},
{
"file": "/Users/karemorstol/Programming/SwiftShell/SwiftShell3/Sources/SwiftShell/Command.swift",
- "line": 260,
+ "line": 279,
"symbol": "AsyncCommand.stderror",
"symbol_kind": "source.lang.swift.decl.var.instance",
"warning": "undocumented"
@@ -168,23 +168,93 @@
"symbol_kind": "source.lang.swift.decl.function.method.static",
"warning": "undocumented"
},
+ {
+ "file": "/Users/karemorstol/Programming/SwiftShell/SwiftShell3/Sources/SwiftShell/Signals.swift",
+ "line": 31,
+ "symbol": "Signals",
+ "symbol_kind": "source.lang.swift.decl.class",
+ "warning": "undocumented"
+ },
+ {
+ "file": "/Users/karemorstol/Programming/SwiftShell/SwiftShell3/Sources/SwiftShell/Signals.swift",
+ "line": 39,
+ "symbol": "Signals.Signal.hup",
+ "symbol_kind": "source.lang.swift.decl.enumelement",
+ "warning": "undocumented"
+ },
+ {
+ "file": "/Users/karemorstol/Programming/SwiftShell/SwiftShell3/Sources/SwiftShell/Signals.swift",
+ "line": 40,
+ "symbol": "Signals.Signal.int",
+ "symbol_kind": "source.lang.swift.decl.enumelement",
+ "warning": "undocumented"
+ },
+ {
+ "file": "/Users/karemorstol/Programming/SwiftShell/SwiftShell3/Sources/SwiftShell/Signals.swift",
+ "line": 41,
+ "symbol": "Signals.Signal.quit",
+ "symbol_kind": "source.lang.swift.decl.enumelement",
+ "warning": "undocumented"
+ },
+ {
+ "file": "/Users/karemorstol/Programming/SwiftShell/SwiftShell3/Sources/SwiftShell/Signals.swift",
+ "line": 42,
+ "symbol": "Signals.Signal.abrt",
+ "symbol_kind": "source.lang.swift.decl.enumelement",
+ "warning": "undocumented"
+ },
+ {
+ "file": "/Users/karemorstol/Programming/SwiftShell/SwiftShell3/Sources/SwiftShell/Signals.swift",
+ "line": 43,
+ "symbol": "Signals.Signal.kill",
+ "symbol_kind": "source.lang.swift.decl.enumelement",
+ "warning": "undocumented"
+ },
+ {
+ "file": "/Users/karemorstol/Programming/SwiftShell/SwiftShell3/Sources/SwiftShell/Signals.swift",
+ "line": 44,
+ "symbol": "Signals.Signal.alrm",
+ "symbol_kind": "source.lang.swift.decl.enumelement",
+ "warning": "undocumented"
+ },
+ {
+ "file": "/Users/karemorstol/Programming/SwiftShell/SwiftShell3/Sources/SwiftShell/Signals.swift",
+ "line": 45,
+ "symbol": "Signals.Signal.term",
+ "symbol_kind": "source.lang.swift.decl.enumelement",
+ "warning": "undocumented"
+ },
+ {
+ "file": "/Users/karemorstol/Programming/SwiftShell/SwiftShell3/Sources/SwiftShell/Signals.swift",
+ "line": 46,
+ "symbol": "Signals.Signal.pipe",
+ "symbol_kind": "source.lang.swift.decl.enumelement",
+ "warning": "undocumented"
+ },
+ {
+ "file": "/Users/karemorstol/Programming/SwiftShell/SwiftShell3/Sources/SwiftShell/Signals.swift",
+ "line": 47,
+ "symbol": "Signals.Signal.user",
+ "symbol_kind": "source.lang.swift.decl.enumelement",
+ "warning": "undocumented"
+ },
{
"file": "/Users/karemorstol/Programming/SwiftShell/SwiftShell3/Sources/SwiftShell/Stream/Lazy-split.swift",
- "line": 26,
+ "line": 23,
"symbol": "LazySplitSequence.remaining",
"symbol_kind": "source.lang.swift.decl.var.instance",
"warning": "undocumented"
},
{
"file": "/Users/karemorstol/Programming/SwiftShell/SwiftShell3/Sources/SwiftShell/Stream/Lazy-split.swift",
- "line": 27,
+ "line": 24,
"symbol": "LazySplitSequence.separator",
"symbol_kind": "source.lang.swift.decl.var.instance",
"warning": "undocumented"
},
{
"file": "/Users/karemorstol/Programming/SwiftShell/SwiftShell3/Sources/SwiftShell/Stream/Lazy-split.swift",
- "line": 28,
+ "line": 25,
"symbol": "LazySplitSequence.allowEmptySlices",
"symbol_kind": "source.lang.swift.decl.var.instance",
"warning": "undocumented"