nsomar / swiftline Goto Github PK
View Code? Open in Web Editor NEWSwiftline is a set of tools to help you create command line applications.
License: MIT License
Swiftline is a set of tools to help you create command line applications.
License: MIT License
Update SPM to latest swift-tools-version
warning: PackageDescription API v3 is deprecated and will be removed in the future
Currently there is no tag for any Swift 3 release.
This makes it impossible to be used in latest SwiftPM
The idea is to add support for globs and quickly iterating a directory. I think it would look very similar to how ruby solves that. Check the documentation for http://ruby-doc.org/core-1.9.3/Dir.html
We can think about translating the following ruby examples to swift
Dir["/**"]
expand the glob and return all the matching filesDir.chdir
change the current directoryDir.foreach(directory)
enumerates the files in the directoryRun a command that outputs big amounts of data in a console, observe waitUntilExit
never exiting.
You can find more info here https://stackoverflow.com/questions/33423993/hanging-nstask-using-waituntilexit
Does Swiftline support Linux? It'd be great if the README noted whether it does or not!
Was wondering how I can compile the script to be an executable?
Tried variations on this
swiftc -framework ./Rome/Swiftline.framework Script.swift -o SciptExectutable
Do you mind giving the most recent commit a tagged version? When using Swift Package Manager I get a warning in a file that is no longer present since Feb 1, 2017:
Source/RunResults.swift:39:82: Conditional downcast from 'NSString?' to 'String' is a bridging conversion; did you mean to use 'as'?
Trying to run unix executable, however always come upon the same issue: "Operation not permitted" What I can do about that?)
If I try to do the following command:
let gitCommand = "git ls-remote --tags \(gitURL) | awk '{print $2}' | grep -v '{}' | awk -F'/' '{print $3}' | sort -n -t. -k1,1 -k2,2 -k3,3 | tail -n 1"
let latestVersion = run(gitCommand).stdout
but it fails. it doesn't give any output and I don't know why. If I execute that command in my terminal it works perfectly fine. I'm not sure if it has to do with the pipelines or with the '
I know it is possible to provide default values when prompting the user for input. See below:
let level = ask("Choose level: ", type: Int.self) { settings in
settings.defaultValue = 1
}
Unfortunately this value is only used in preparedItem()
which is not called anywhere. When the user does not provide an input he gets the message to enter a valid integer despite the fact I chose a default value.
public class AskSettings<T: ArgConvertibleType> {
/// Default value to set incase the user entered a blank
public var defaultValue: T?
...
func preparedItem(originalString string: String) -> T {
if string.isEmpty && defaultValue != nil {
return defaultValue!
}
return T.fromString(string)!
}
}
like Swift 4/4.2/5
Hi there,
I'm trying to include swiftline into a fresh Swift command line template Xcode project. I've built swiftline using carthage and included it in the "Link Binaries With Libraries" section to no avail.
dyld: Library not loaded: @rpath/Swiftline.framework/Versions/A/Swiftline
Referenced from: /Users/cooltrooper/Library/Developer/Xcode/DerivedData/wlV1-fnrxshgimtnooghhhpyaripgrewy/Build/Products/Debug/wlV1
Reason: image not found
Any tips?
I think we should leave this issue open until Swift 3.0 support is released.
Hi there,
Xcode (Version 11.3.1) can't resolve the package and is throwing the following error message:
The package dependency graph can not be resolved; unable find any available tag for the following requirements:
https://github.com/nsomar/Swiftline โ 0.5.0..<1.0.0
Maybe I've specified the versions wrong?
If I do a run operation with a directory name with space, operation fails.
For example:
run("open '/Users/myname/path with space'")
or even
run("open \"/Users/myname/path with space\"")
Issue is with the splitCommandToArgs method implemented in RunResults.swift which uses components(separatedBy:)
API
I would love to pass in my own string i.e "hey --flag value" and have it parsed using Args.
I'm running in it seems to not do anything (it is a long running command but it seems to never finish)
If I run the command from the command line terminal it does complete
Is there a way to continually output the stdout (Not wait for the result)
let archiveCommand = "some command to run"
let res = run(archiveCommand) // never completing through my script
I have the latest cocapods and rome installed
cocoapods (1.1.0.rc.2, 1.0.1)
cocoapods-core (1.1.0.rc.2, 1.0.1)
cocoapods-deintegrate (1.0.1)
cocoapods-downloader (1.1.1)
cocoapods-plugins (1.0.0)
cocoapods-rome (0.7.0)
cocoapods-search (1.0.0)
cocoapods-stats (1.0.0)
cocoapods-trunk (1.0.0)
cocoapods-try (1.1.0)
And I get error:
[!] The dependency `Swiftline (from `../Swiftline.podspec`)` is not used in any concrete target.
I believe Podfile syntax has changed to require a target, but I don't understand how thats supposed to work with these CLI rome framework scripts?
Is there something broken here or am I doing it wrong?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.