Skip to content

Commit

Permalink
Version 2.1.3
Browse files Browse the repository at this point in the history
- Now using the `SwiftPackagesBase` library to replace the array extensions implementation.
- Removed the implementation of the array extensions.
- Updated README, added info in the source code and updated copyright dates.
  • Loading branch information
ITzTravelInTime committed May 31, 2022
1 parent 2eed73c commit f8aecca
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 68 deletions.
4 changes: 3 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:5.3
// swift-tools-version:5.0
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription
Expand All @@ -19,6 +19,7 @@ let package = Package(
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
//.package(url: "https://github.com/ITzTravelInTime/TINURecovery", from: "2.0.0"), //Use this package for sandbox detection, find the line containing Sandbox.isEnabled and uncomment it.
.package(url: "https://github.com/ITzTravelInTime/SwiftPackagesBase", from: "0.0.5")
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
Expand All @@ -27,6 +28,7 @@ let package = Package(
name: "Command",
dependencies: [
//.byName(name: "TINURecovery")
"SwiftPackagesBase"
]),
.testTarget(
name: "CommandTests",
Expand Down
25 changes: 15 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# Command
Swift Library to launch, run and get the output of executables and terminal commands/scripts in a simple and quick way.

# Features
## Features
- Manages the usage of Swift's `Process` Objects, and so allows the library user to: launch, run or just get the standard output/error of a `Process` execution
- Provvides comvenint structs for abstraction and ease of usage
- Allows for class extensions, and extension libraryes to increase the functionality offered (see the `Known extensions for this library` section for more info)
- Provvides a protocol for extensions to conform to the basic usage of the main class
- Debug checks to ensure the library code is used as intended
- No particular dependecies

# Usage
## Usage

Usage is well documented into the source code, so check that out for more info. To prevent having mirrors of this information, this file will be just limited to the following very usefoul example usage:

Expand Down Expand Up @@ -40,38 +40,43 @@ print(info() ?? "Error: launch of the \"uname -a\" command failed!")

```

# What apps/programs is this Library intended for?
## What apps/programs is this Library intended for?

This library should be used by non-sandboxed swift apps/programs (unless only commands targeted at embedded executables inside the current bundle are run) or embedded helper tools, that needs to run terminal scripts/commands or separated executables from their own.

This code is intended for macOS only since it requires the system library `Process` type from the Swift API, that is only available on that platform.

# **Warnings**
## **Warnings**

- To let the code to fully work (expecially the `Command.run` and the `Command.get...` functions ) your app/program might most likely need to not be sandboxed, unless an executable located inside the current bundle is specified, see the documentation inside the source code for more details.
- All functions from the `Command` class needs to be run from a non-main thread, except from the `Command.start` function.

# Known extensions for this library
## Known extensions for this library

- [ITzTravelInTime/CommandSudo](https://github.com/ITzTravelInTime/CommandSudo) Adds support for privileged executions using apple scripts.

# About the project
## About the project

This code was created as part of my [TINU project](https://github.com/ITzTravelInTime/TINU) and it has been separated and made into it's own library to make the main project's source less complex and more focused on it's aim.

Also having this as it's own library allows for code to be updated separately and so various versions of the main TINU app will be able to be compiled all with the latest version of this library.

# Credits
## Used libraries

- [ITzTravelInTime/SwiftPackagesBase](https://github.com/ITzTravelInTime/SwiftPackagesBase)

## Credits

- ITzTravelInTime (Pietro Caruso) - Project creator and main developer

# Contacts
## Contacts

- ITzTravelInTime (Pietro Caruso): piecaruso97@gmail.com

# Copyright
## Legal info

Copyright (C) 2021 Pietro Caruso
Swift Library to launch, run and get the output of executables and terminal commands/scripts in a simple and quick way.
Copyright (C) 2021-2022 Pietro Caruso

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

Expand Down
12 changes: 12 additions & 0 deletions Sources/Command/Command.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
/*
Swift Library to launch, run and get the output of executables and terminal commands/scripts in a simple and quick way.
Copyright (C) 2021-2022 Pietro Caruso
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/

import Foundation
import SwiftPackagesBase
//import TINURecovery

#if os(macOS)
Expand Down
39 changes: 0 additions & 39 deletions Sources/Command/Extensions.swift

This file was deleted.

16 changes: 10 additions & 6 deletions Sources/Command/Print.swift
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
//
// Print.swift
// Command
//
// Created by Pietro Caruso on 15/07/21.
//
/*
Swift Library to launch, run and get the output of executables and terminal commands/scripts in a simple and quick way.
Copyright (C) 2021-2022 Pietro Caruso
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/

import Foundation

Expand Down
17 changes: 11 additions & 6 deletions Sources/Command/Protocols.swift
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
//
// File.swift
//
//
// Created by Pietro Caruso on 10/07/21.
//
/*
Swift Library to launch, run and get the output of executables and terminal commands/scripts in a simple and quick way.
Copyright (C) 2021-2022 Pietro Caruso
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/

import Foundation
import SwiftPackagesBase

#if os(macOS)

Expand Down
15 changes: 9 additions & 6 deletions Sources/Command/Structs.swift
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
//
// File.swift
//
//
// Created by Pietro Caruso on 10/07/21.
//
/*
Swift Library to launch, run and get the output of executables and terminal commands/scripts in a simple and quick way.
Copyright (C) 2021-2022 Pietro Caruso
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
import Foundation

#if os(macOS)
Expand Down

0 comments on commit f8aecca

Please sign in to comment.