Yaron Minsky avatar Yaron Minsky committed 74784b4

initial import

Comments (0)

Files changed (5)

+syntax: glob
+
+_build
+*.cmo
+*.native
+*.byte
+*~
+Hello World for Core
+====================
+
+A simple hello-world project for Core.  The intent is to show you how
+to get started building OCaml projects using OPAM, Core and
+OCamlbuild.  To use this, first get OPAM, and install the "core"
+package.  Also, it's probably doing this:
+
+    opam switch ocaml-4.00.1+short-types
+
+to get better error messages from the compiler when using Core.  (As
+of 4.01, this compiler variant should be obsolete.)
+
+You can build the project by running:
+
+    ./build.sh hello_world.native
+
+and you can then use it as follows:
+
+    core-hello-world $ ./hello_world.native
+    Hello World!
+    core-hello-world $ ./hello_world.native -h
+    Hello World
+
+      hello_world.native 
+
+    === flags ===
+
+      [-hello]       The 'hello' of 'hello world'
+      [-world]       The 'world' of 'hello world'
+      [-build-info]  print info about this build and exit
+      [-version]     print the version of this build and exit
+      [-help]        print this help text and exit
+                     (alias: -?)
+
+    flag -h is an ambiguous prefix: -hello, -help
+    core-hello-world $ ./hello_world.native -hello "Goodbye" -world "Yellow Brick Road"
+    Goodbye Yellow Brick Road!
+
+true: syntax(camlp4o)
+true: package(core,sexplib.syntax,bin_prot.syntax,comparelib.syntax,fieldslib.syntax,variantslib.syntax)
+true: thread,debug,annot
+#!/usr/bin/env bash
+
+eval `opam config -env`
+
+for TARGET in $*
+do
+  ocamlbuild -use-ocamlfind $TARGET -cflags "-w @A-4-33-23"
+done
+
+
+open Core.Std
+
+let command =
+  Command.basic
+    ~summary:"Hello World"
+    Command.Spec.(
+      empty
+      +> flag "-hello" (optional_with_default "Hello" string)
+        ~doc:" The 'hello' of 'hello world'"
+      +> flag "-world" (optional_with_default "World" string)
+        ~doc:" The 'world' of 'hello world'"
+    )
+    (fun hello world () ->
+      printf "%s %s!\n" hello world
+    )
+
+let () =
+  Command.run command
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.