-
Notifications
You must be signed in to change notification settings - Fork 4
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
Add no-save feature #4
Conversation
Sources/ToyboxKit/Handler.swift
Outdated
public var rootURL: URL { | ||
return Workspace.rootURL | ||
} | ||
|
||
public init() { | ||
executeAutoremove() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is in the initializer because I want to remove files every command execution. Do you have any better idea?
3394222
to
c491bb4
Compare
c491bb4
to
01e149b
Compare
01e149b
to
68b1522
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Could you add an example to README?
I prefer to add shorthand. Do you have any idea?
Sources/toybox/Commands/Create.swift
Outdated
@@ -38,6 +40,7 @@ struct CreateOptions: OptionsProtocol { | |||
<*> m <| Switch(flag: "f", key: "force", usage: "Whether to overwrite existing playground") | |||
<*> m <| Switch(key: "no-open", usage: "Whether to open new playground") | |||
<*> m <| Switch(key: "input", usage: "Whether to enable standard input") | |||
<*> m <| Switch(key: "no-save", usage: "Remove playground file automatically") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer to also add shorthand. (But I have no idea....)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I votes -n
(though I know it may cause confusion with --no-save
--no-open
...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We also have no-open
option...
@@ -63,6 +71,23 @@ class HandlerTests: XCTestCase { | |||
XCTAssertTrue(manager.fileExists(atPath: playgroundURL(for: "hello").path)) | |||
} | |||
|
|||
func testCreateWithTemporaryOption() { | |||
_ = handler.create("hello", for: .iOS, temporary: true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should use @discardableResult
. (I'm goint to add after this.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks 🎉 |
Thank you @morishin ❤️ Upgrade Toybox to 0.2.0 with Homebrew to use new feature. $ brew upgrade giginet/toybox/toybox |
Closes #3
I implemented autoremove feature.
<name>.autoremove.playground
with--rm
option..autoremove
suffix are not shown bytoybox list
command..autoremove
suffix every timetoybox
command has been called.Please review it @giginet