Commit Graph

253 Commits

Author SHA1 Message Date
Kare Morstol 1f07d40f04 Make error messages more concise and to the point. 2015-10-29 00:21:31 +01:00
Kare Morstol 6065d0226f Add a trailing / to ‘main.currentdirectory’ too.
I should probably be using NSURLs for file paths, but they are just so cumbersome to work with in Swift. Besides many file operations in Foundation require strings, not NSURLs.
2015-10-19 02:24:45 +02:00
Kare Morstol cab35b4078 Add a trailing / to ‘main.tempdirectory’. 2015-10-18 23:44:22 +02:00
Kare Morstol 70319b54db Update test scripts for SwiftShell 2.0.
Finally.
2015-10-16 03:52:47 +02:00
Kare Morstol b447059e3e Add ‘open’ functions for writing to files. 2015-10-16 03:30:44 +02:00
Kare Morstol 1d07e1db41 Add main.tempdirectory . 2015-10-16 02:10:21 +02:00
Kare Morstol 796af16d1a Add 'open' functions for reading files. 2015-10-15 23:05:20 +02:00
Kare Morstol f1ef868d96 Set deployment target to OS X 10.9.
Might as well, we are not using any new APIs from Foundation.
2015-10-14 19:04:19 +02:00
Kare Morstol 2de04312b5 Test using streams with ‘print’. 2015-10-07 20:09:13 +02:00
Kare Morstol 93809fa694 Enable strings to run commands using themselves as standard input. 2015-10-07 18:48:04 +02:00
Kare Morstol 99df0ddf19 Enable ReadableStream to run commands using itself as stdin. 2015-10-07 18:42:19 +02:00
Kare Morstol 236a424190 Make AsyncShellTask's stdin and stderror ReadableStreams too. 2015-10-07 17:31:04 +02:00
Kare Morstol 2ea2c5ccce Make shellcontext's stdin and stderror be ReadableStream and WriteableStream. 2015-10-07 16:37:18 +02:00
Kare Morstol 31508d338c Create ReadableStream and streams() . 2015-10-07 15:33:06 +02:00
Kare Morstol a521828ddb Create WriteableStream, make shellcontext.stdout into one. 2015-10-07 15:09:43 +02:00
Kare Morstol c3484d626f Test effects of context.currentdirectory on NSURL.baseURL . 2015-10-06 18:59:03 +02:00
Kare Morstol 1a6fdc7f2c Clean up documentation indentation.
Looks nicer on GitHub now, but documentation looks awful in Xcode Quick Help Inspector. It apparently demands I use spaces for indentation. I have some grumbling and reiteration of the virtues of tabs for indentation left to do before I give in.
2015-10-06 18:30:10 +02:00
Kare Morstol 6ff91b2b57 Make pathForExecutable an inner function. 2015-10-06 18:25:08 +02:00
Kare Morstol b7dab5666e Remove completely unnecessary double spaces. 2015-10-04 20:25:39 +02:00
Kare Morstol 560ea1e8ec Let 'pathForExecutable' use its context's environment. 2015-10-04 20:22:39 +02:00
Kare Morstol 171ba23f0b Move 'run*' commands over to protocol ShellRunnable. 2015-10-04 19:50:13 +02:00
Kare Morstol d4c2bbed89 Add unit tests for running commands from custom context. 2015-10-04 19:22:23 +02:00
Kare Morstol 604756f5b3 Add file and linenr to error messages from 'runAsync'. 2015-10-02 23:37:58 +02:00
Kare Morstol a9d6197aee Specify what error runAndPrint (bash bashcommand: String) can throw. 2015-09-27 00:55:50 +02:00
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