Stof Docs
Star on GitHubStof WebsiteDiscordContact Us
  • 🚀Welcome
  • â„šī¸Resources & Information
  • Book
    • Data Interface
    • Introduction & Design
    • Host Environments
      • Rust
      • TypeScript
        • Extend Stof
        • Import Statement
    • Data Interchange
      • JSON to Stof
      • Importing and Parsing Data
      • Exporting Data
      • REST and Restructure
    • Configuration Files
    • Schemas
      • Renaming Fields
      • Removing Fields
      • Validation & Transformation
        • Example Access
      • Nested Schemas
    • Orchestration
  • Common Concepts
    • Objects
    • Primitive Types
    • Functions
    • Fields
    • Object Types
    • Imports
    • Error Handling
    • Units
    • Casting/Conversions
  • Reference
    • CLI
      • 🏃Run
      • đŸ§ĒTest
      • 📚CLI Libraries
        • Filesystem Library
        • Time Library
        • HTTP Library
    • Stof Language
    • Libraries
      • Standard Library
      • Array/Vector Library
      • Number Library
      • String Library
      • Object Library
      • Function Library
      • Set Library
      • Map Library
      • Data Library
      • Tuple Library
      • Blob Library
      • Boolean Library
    • đŸĒ§Formats
Powered by GitBook
On this page
  • Options
  • Hello World
  • Multiple Mains

Was this helpful?

  1. Reference
  2. CLI

Run

Running a Stof document with the CLI.

PreviousCLINextTest

Last updated 3 months ago

Was this helpful?

If you haven't yet, install the binary. More instructions can be found on the Resources & Information page.

> stof run <OPTIONS> <FILE>.stof

Options

  • -a, --allow <ALLOW>

    • Add an additional library to use by name. By default, the CLI gives access to read and write files on the system (for imports), but nothing else. If for example you want to give Stof access to the network, you'll need to pass "-a http".

      • http - Gives Stof an for making network calls.

      • github - Gives Stof access to via the GitHub API. A package manger will be released soon.

Hello World

file: hello.stof

#[main]
fn main() {
    pln("hello world");
}
> stof run hello.stof
hello world

Multiple Mains

Stof can have #[main] functions anywhere in the document. Their order of execution is not deterministic and will change. For more info on function attributes, see Functions.

file: mains.stof

#[main]
fn doSomething() {
    pln("does something");
}

#[main]
fn doAnother() {
    pln("doing another thing");
}
> stof run mains.stof
does something
doing another thing
🏃
stof-cli
HTTP interface
additional files hosted on GitHub