Skip to content
Closed
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
10 changes: 8 additions & 2 deletions src/amber/cli/commands/exec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,14 @@ module Amber::CLI

class Exec < Command
command_name "exec"
@filename : String = "./tmp/#{Time.now.epoch_ms}_console.cr"
@filelogs : String = @filename.sub("console.cr", "console_result.log")
@filename : String
@filelogs : String

def initialize(__previous, __argv)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use *args and super?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was the minimum change. But it should be equivalent.

@filename = "./tmp/#{Time.now.epoch_ms}_console.cr"
@filelogs = @filename.sub("console.cr", "console_result.log")
super(__previous, __argv)
end

class Options
arg "code", desc: "Crystal code or .cr file to execute within the application scope", default: ""
Expand Down