All Projects → RxSwiftCommunity → RxTask

RxSwiftCommunity / RxTask

Licence: MIT license
An RxSwift implementation of a command line runner.

Programming Languages

swift
15916 projects
shell
77523 projects

Projects that are alternatives of or similar to RxTask

RxResponderChain
RxResponderChain
Stars: ✭ 18 (+28.57%)
Mutual labels:  rxswift, rxswift-extensions
Xcoordinator
🎌 Powerful navigation library for iOS based on the coordinator pattern
Stars: ✭ 1,752 (+12414.29%)
Mutual labels:  rxswift, rxswift-extensions
RxApolloClient
RxSwift extensions for Apollo Client
Stars: ✭ 46 (+228.57%)
Mutual labels:  rxswift, rxswift-extensions
Phexecute
Phexecute - Awesome PHP Code Runner
Stars: ✭ 18 (+28.57%)
Mutual labels:  runner
huginn
Programming language with no quirks, so simple every child can master it.
Stars: ✭ 41 (+192.86%)
Mutual labels:  runner
executor
A powerful "short-cutter" to your console to you and your team!
Stars: ✭ 21 (+50%)
Mutual labels:  runner
RxJSON
RxSwift wrapper for JSON
Stars: ✭ 33 (+135.71%)
Mutual labels:  rxswift
SwiftObserver
Elegant Reactive Primitives for Clean Swift Architecture #NoRx
Stars: ✭ 14 (+0%)
Mutual labels:  rxswift
GitTime
GitTime is GitHub Tracking App. Using ReactorKit, RxSwift, Moya.
Stars: ✭ 55 (+292.86%)
Mutual labels:  rxswift
RxSwift-Workshops
EL Passion - RxSwift Workshops
Stars: ✭ 41 (+192.86%)
Mutual labels:  rxswift
github-actions-runner
No description or website provided.
Stars: ✭ 19 (+35.71%)
Mutual labels:  runner
WWDCast
The unofficial WWDC application for iOS
Stars: ✭ 22 (+57.14%)
Mutual labels:  rxswift
Boomerang
Swift micro-framework for MVVM (Model-View-ViewModel) native applications.
Stars: ✭ 34 (+142.86%)
Mutual labels:  rxswift
Swift-VIPER-Rx
VIPER architecture model. Show a single class of responsibility.
Stars: ✭ 19 (+35.71%)
Mutual labels:  rxswift
MVVM-Templates
Templates for MVVM architecture for swift (based on RxSwift)
Stars: ✭ 14 (+0%)
Mutual labels:  rxswift
JetBrainsRunner
A Krunner Plugin which allows you to open your recent projects
Stars: ✭ 31 (+121.43%)
Mutual labels:  runner
Gank
A iOS Client of gank.io written in Swift4.0 and Build with RxSwift + Moya + MVVM.
Stars: ✭ 80 (+471.43%)
Mutual labels:  rxswift
Monotone
An Unsplash Application for iOS.
Stars: ✭ 181 (+1192.86%)
Mutual labels:  rxswift
pronto-credo
pronto runner for credo, a code analysis tool for Elixir programming language
Stars: ✭ 12 (-14.29%)
Mutual labels:  runner
swift-boilerplate
Clean Architecture for iOS projects (Swift + Programmatically UI + MVC + RxSwift + Auto Layout Visual Format + REST + JWT)
Stars: ✭ 14 (+0%)
Mutual labels:  rxswift

RxTask

An RxSwift implementation of a command line task runner.

GitHub release Build Status codecov docs carthage compatible swift package manager compatible platform macOS language swift 3.0

Linux Compatibility

Currently, RxTask does not support Linux. RxTask relies on some functionality in Foundation that is currently not available in the Linux port. This will be re-evaluated after the Swift 3.1 release. PRs in this area are quite welcome! 👍

Installation

Carthage

github "RxSwiftCommunity/RxTask"

SPM

import PackageDescription

let package = Package(
    name: "YOUR_PROJECT_NAME",
    targets: [],
    dependencies: [
        .Package(url: "https://github.com/RxSwiftCommunity/RxSwift.git", majorVersion: 0)
    ]
)

Usage

Create A Task

Creating a task is as simple as providing a launchPath to the executable.

let task = Task(launchPath: "/bin/ls")

Optionally, you can provide arguments, a workingDirectory, and an environment.

let task = Task(launchPath: "/bin/echo", arguments: ["$MESSAGE"], environment: ["MESSAGE": "Hello World!"])

Launch A Task

Tasks can be launched with the launch() method. This produces a self-contained process. This means the same task can be launch()ed multiple times producing separate processes.

TaskEvent

The output of launch() is a Observable<TaskEvent>. TaskEvent is an enum that is used to report significant events in the task lifetime. The possible events are:

  • launch(command: String)
  • stdOut(Data)
  • stdErr(Data)
  • exit(statusCode: Int)

Note: Currently an event is only considered successful if it exits with a statusCode of 0. Other exit statuses will be considered a TaskError.

StdIn

If you create a task that expects input, you can provide an Observable<Data> for stdin when you are launch()ing the Task. Data will be written to stdin as soon as it is emitted by the Observable.

Filtering TaskEvents

If you are only concerned with whether a Task has completed successfully, you can use the built-in operator justExitStatus().

Task(launchPath: "/bin/ls").launch()
    .justExitStatus()
    .subscribe(onNext: { exitStatus in /* ... */ })
    .disposed(by: disposeBag)

Alternatively, if you are only interested in the output of a Task, you can use the operator justOutput(). This will send the output of both stdout and stderr.

Task(launchPath: "/bin/ls").launch()
    .justOutput()
    .subscribe(onNext: { output in /* ... */ })
    .disposed(by: disposeBag)

TaskError

TaskError is an Error that will be emitted under the following situations:

  • uncaughtSignal: The Task terminated with an uncaught signal (e.g. SIGINT).
  • exit(statusCode: Int): The Task exited with a non-zero exit code.

API Reference

Full docs can be found here.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].