Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP make swiftline compile on linux #30

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -171,4 +171,5 @@ crashlytics-build.properties
Examples/Rome/
TestPackage/.build
.build/
SwiftlineTests/Carthage/Checkouts
SwiftlineTests/Carthage/Checkouts
.DS_STORE
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ install:


script:
- make generate
- make test
- pod lib lint --quick

Expand Down
22 changes: 0 additions & 22 deletions Examples/ColorizeExample.swift

This file was deleted.

19 changes: 0 additions & 19 deletions Examples/EnvAndArgs.swift

This file was deleted.

7 changes: 7 additions & 0 deletions Examples/Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import PackageDescription

let package = Package(name: "Example",
dependencies: [
.Package(url: "../", majorVersion: 0),
]
)
6 changes: 0 additions & 6 deletions Examples/Podfile

This file was deleted.

20 changes: 0 additions & 20 deletions Examples/Podfile.lock

This file was deleted.

21 changes: 7 additions & 14 deletions Examples/Readme.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
To run examples

Install [cocoapods-rome](https://github.com/neonichu/Rome)
Run `swift build`

$ gem install cocoapods-rome
Run `pod install`
This will build all the examples that can be found in `.build`:

---
To run any example:

chmod a+x Example.swift
./Example.swift


For example to run `ColorizeExample.swift`

chmod a+x ColorizeExample.swift
./ColorizeExample.swift
- `agree_example` shows the `agree` functionality
- `args_example` shows the `args` parsing functionality
- `ask_example` shows the `ask` functionality
- `choose_example` shows the `choose` functionality
- `colorize_example` shows the `colorize` functionality
21 changes: 0 additions & 21 deletions Examples/RunnerExample.swift

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/usr/bin/env xcrun swift -F ./Rome/ -framework Swiftline

import Swiftline

let answer = agree("Are you shwifty?")
Expand Down
9 changes: 9 additions & 0 deletions Examples/src/args_example/main.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import Swiftline

print("\nPrint all Arguments")
print(Args.all)

print("\nPrint parsed Arguments")
print("Target = \(Args.parsed.flags["target"] ?? "")")
print("Framework = \(Args.parsed.flags["framework"] ?? "")")
print(Args.parsed.parameters)
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/usr/bin/env xcrun swift -F ./Rome/ -framework Swiftline

import Swiftline

// Ask for a String
Expand All @@ -14,10 +12,11 @@ print("\nYour age is \(age)\n")

// Ask with validation
let name = ask("Who are you?") { settings in
settings.addInvalidCase("Snuffles is not allowed") { value in
value.containsString("Snuffles")
}
settings.addInvalidCase("Snuffles is not allowed") { value in
return value == "snuffles"
}
}

print("\nYour are \(name)\n")


Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/usr/bin/env xcrun swift -F ./Rome/ -framework Swiftline

import Swiftline


Expand All @@ -24,7 +22,7 @@ let choice3 = choose("Whats your favorite programming language? ", type: String.
//choice value will be set to BAD
settings.addChoice("Java") { "BAD" }

settings.index = .Letters
settings.index = .letters
settings.indexSuffix = " ----> "
}
print("Your choice is \(choice3)")
20 changes: 20 additions & 0 deletions Examples/src/colorize_example/main.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import Swiftline


// To change the text color, use either string.f or string.foreground:
print("Red String".f.red)
print("Blue String".foreground.blue)


// To change the text background color, use either string.b or string.background:
print("I have a white background".b.white)
print("My background color is green".background.green)


// To change the text background color, use either string.s or string.style:
print("I am a bold string".s.bold)
print("I have an underline".style.underline)


// You can compose foreground, background, and style:
print("I am an underlined red on white string".s.underline.f.red.b.white)
39 changes: 19 additions & 20 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
build_help:
cd SwiftlineTests && jazzy \
--clean \
--author NSOmar \
--author_url https://nsomar.com \
--github_url https://github.com/swiftline/swiftline \
--github-file-prefix https://github.com/swiftline/swiftline \
--module-version 0.2.0 \
test:
xcodebuild -project Swiftline.xcodeproj -scheme Swiftline build test

coverage:
slather coverage Swiftline.xcodeproj

generate:
swift package generate-xcodeproj --enable-code-coverage

doc:
rm -rf docs
make generate

jazzy \
--author "Omar Abdelhafith" \
--author_url http://swifline.com \
--github_url https://github.com/oarrabi/Swiftline/tree/master \
--xcodebuild-arguments -scheme,Swiftline \
--module Swiftline \
--github-file-prefix https://github.com/oarrabi/Swiftline \
--theme fullwidth
--output ../../Docs/swift_output
git stash
git checkout gh-pages
Expand All @@ -20,14 +30,3 @@ build_help:
git push origin gh-pages --force
git co -
- git stash pop

test:
cd SwiftlineTests; xcodebuild -project Swiftline.xcodeproj -scheme Swiftline clean build test -sdk macosx GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES GCC_GENERATE_TEST_COVERAGE_FILES=YES

test-spm:
cd TestPackage && rm -rf .build
cd TestPackage && swift build

build-spm:
rm -rf .build
swift build
3 changes: 2 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import PackageDescription

let package = Package(
name: "Swiftline"
name: "Swiftline",
dependencies: [.Package(url: "https://github.com/oarrabi/StringScanner", majorVersion: 0)]
)
Loading