Kare Morstol
e20717767b
Add file and linenr to error messages from 'exit' and 'run'.
2015-09-27 00:53:31 +02:00
Kare Morstol
f760841635
Rename setupTask to createTask.
2015-09-27 00:20:17 +02:00
Kare Morstol
325af43d42
Include the command when throwing ShellError.ReturnedErrorCode .
2015-09-26 23:46:39 +02:00
Kare Morstol
19bd97a7b0
Improve documentation and code organization.
2015-09-26 21:07:39 +02:00
Kare Morstol
bc4f0d76ca
Return exit code 127 on InAccessibleExecutable.
2015-09-25 02:26:37 +02:00
Kare Morstol
89e06acc72
Give 'run' and 'runAsync' much nicer errors when running inaccessible executables.
...
- add ShellError.InAccessibleExecutable
- add ShellError.errorcode
- add exit(ErrorType)
2015-09-25 02:18:05 +02:00
Kare Morstol
e13202ad09
runAndPrint throws error when command is inaccessible.
2015-09-25 00:26:09 +02:00
Kare Morstol
a747b13228
Create struct ShellContext:ShellContextType .
2015-09-23 03:33:29 +02:00
Kare Morstol
1bb3b0fcf7
README: Add Carthage badge of compatibility.
...
Because it is. Compatible that is.
2015-09-23 02:57:24 +02:00
Kare Morstol
b253497f07
Let run* commands find path to executable automatically.
2015-09-23 02:27:16 +02:00
Kare Morstol
e0a8087a98
Remove references to Carthage from test target build settings.
2015-09-22 02:03:33 +02:00
Kare Morstol
acb1fe6cc1
Improve documentation of Context.swift .
2015-09-22 01:57:44 +02:00
Kare Morstol
638fb719df
Make more properties of MainShellContext lazy.
...
Will be important later on if/when I implement truly global standard input/output redirection.
2015-09-22 01:56:25 +02:00
Kare Morstol
1ce3f6e165
Simplify [Any].flatten() .
2015-09-22 01:44:00 +02:00
Kare Morstol
8c227b8fae
Let run* commands take shell arguments of any type.
2015-09-21 23:21:00 +02:00
Kare Morstol
3f09e7498d
Add [Any].flatten() .
2015-09-20 20:12:42 +02:00
Kare Morstol
d6055c6062
Remove CatchingFire framework and add it as a single file.
...
Carthage 0.9.1 is not compatible with the catching fire framework as it has too many SDKs (5). It seems 2 is the limit. In any case it was a bit too much trouble and overhead just to include the functionality of this one file.
2015-09-19 19:09:30 +02:00
Kare Morstol
5d6ec53c96
Remove SpeedTests. Belonged to SwiftShell 1.
2015-09-19 18:17:24 +02:00
Kare Morstol
4c09bc8d47
Let ‘main’ be a constant.
...
Well duh.
2015-09-17 14:54:05 +02:00
Kare Morstol
32d68a329d
Fix bug in main.arguments
...
Process.arguments is never empty as the first item is always the path of the script.
Except for in a playground where it actually is empty.
2015-09-17 01:36:23 +02:00
Kare Morstol
04a1e03e7a
Improve error handling and messages when writing and reading to/from filehandles.
...
And use NSStringEncoding as type for encoding.
2015-09-14 19:48:07 +02:00
Kare Morstol
d49bd67109
Update README for SwiftShell 2.0
...
Documentation to be continued.
2015-09-14 17:15:31 +02:00
Kare Morstol
a222c4d15a
Implement "NSURL / String" operator.
...
Overriding a standard operator for a completely different use case like this is not normally recommended, but I think it is warranted here. It's certainly a lot better than "URLByAppendingPathComponent".
2015-09-08 23:44:09 +02:00
Kare Morstol
f41f243630
Move everything Bash to its own file.
...
Command.swift is getting pretty long.
2015-09-08 23:11:18 +02:00
Kare Morstol
91abb8c47c
Update test scripts.
...
The rest are waiting for reading and writing files to be implemented.
2015-09-08 18:06:49 +02:00
Kare Morstol
2d368bf7d6
Remove old Xcode project and unused files.
2015-09-08 18:04:37 +02:00
Kare Morstol
509f762050
Enable whole module optimisation for release builds.
2015-09-08 15:49:21 +02:00
Kare Morstol
a05d7701e1
Turn ‘main’ into a final class.
...
There should be absolutely no doubt ‘main’ is a singleton.
2015-09-08 00:39:05 +02:00
Kare Morstol
c8c70882ce
Improve documentation for run* .
2015-09-08 00:28:08 +02:00
Kare Morstol
9cfd7e5c39
Add run*(executable: String, _ args: [String]). Make global versions of main.run* .
...
All unit tests use global functions.
Removed unnecessary testFinishReturnsSelf.
2015-09-07 23:58:50 +02:00
Kare Morstol
93922a4101
Fix main.name .
...
Now prints the script's name instead of its path.
2015-09-07 22:17:37 +02:00
Kare Morstol
bacdbddddc
Implement ShellContextType.runAndPrint .
2015-09-06 20:58:31 +02:00
Kare Morstol
4a3da01d5d
Move finish() to NSTask.
2015-09-06 18:18:36 +02:00
Kare Morstol
c6975aefd1
Make AsyncShellTask.finish return self.
...
For method chaining.
2015-09-03 18:25:28 +02:00
Kare Morstol
de708331a8
Add 'ShellError', which may be thrown from completed shell commands.
2015-09-03 17:45:28 +02:00
Kare Morstol
10cf827d8b
Add CatchingFire testing framework.
...
For testing error handling.
2015-09-03 17:27:07 +02:00
Kare Morstol
239d32edfd
Rename ‘$’ to ‘run’.
...
Trying to not repeat the mistakes of bash shell scripting here.
2015-09-02 17:34:40 +02:00
Kare Morstol
a8bfc6b1a6
Add 'runAsync' commands for asynchronous shell execution.
2015-09-02 16:55:33 +02:00
Kare Morstol
c8bde4b57b
Rename 'printErrorAndExit(' to 'exit(errormessage:'.
2015-08-13 20:20:44 +02:00
Kare Morstol
73c405787a
Allow ‘writeln’ to write anything, just like ‘write’.
2015-08-13 20:13:05 +02:00
Kare Morstol
e868d67050
Fix assert message.
2015-08-13 20:09:57 +02:00
Kare Morstol
b45ccd814c
Add unit tests for everything that doesn't result in printErrorAndExit.
...
As verified by the wonderful new code coverage feature of Xcode.
2015-08-09 23:07:27 +02:00
Kare Morstol
2cd0b9bf4d
Trim even if one-line-string does not end with \n.
...
I do think a string with only one newline, placed at the end, still has just one line.
2015-08-09 22:37:47 +02:00
Kare Morstol
a23f680cbf
Allow $() to read from stdin.
2015-08-09 22:35:51 +02:00
Kare Morstol
94a5215c1d
Enable Code Coverage. To write some missing unit tests.
2015-08-09 22:34:54 +02:00
Kare Morstol
46948ed806
Fix wildly misleading line in doc for ShellContextType.currentdirectory.
2015-08-09 22:24:57 +02:00
Kare Morstol
2ce7810a37
Update for Xcode 7 beta 5.
2015-08-06 23:18:45 +02:00
Kare Morstol
da3a0f5361
Add $(bash:) . Refactor command.swift.
...
Had to add leading spaces (shudder) to the documentation comment to get Xcode to render it properly. Hopefully this is just a temporary fix.
2015-08-06 03:49:57 +02:00
Kare Morstol
5ce7196bf7
Let NSFileHandle.write accept anything.
2015-08-05 23:23:07 +02:00
Kare Morstol
60e98f3ba5
Add assertion via shell command to testCurrentDirectory_CanChange.
2015-08-05 21:12:37 +02:00