Statements that became commands
An action is a command, so its result can be used in an expression.
| Before | Now |
|---|---|
the write statement |
@write_text(path, text), @append_text(path, text) or @write_json(path, value) (KScript.IO) |
the move and copy statements |
@move(from, to), @copy(from, to) (KScript.IO) |
the delete statement |
@delete(path) (KScript.IO) |
the mkdir statement |
@create_folder(path) (KScript.IO) |
the assert statement |
@assert(condition, message?) (KScript.Test) |
the stylesheet statement |
@stylesheet(path, vars?), which returns the CSS: @write_text('site.css', @stylesheet('theme.ks.css')) (KScript.Style) |
the dispatch statement |
the job's own method: SendWelcome(user_id: 7)->dispatch(), with delay:, at:, queue: or connection: (KScript.Queue) |
the download statement |
@download(url, to), which returns the path of the file it saved (KScript.Net) |
the redirect statement |
return @redirect(/thanks) in a controller (KScript.Http); <respond redirect="/thanks" /> in a page |