Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env fsharpi
#I "../../../.nuget/packages/hopac/0.3.21/lib/net45/"
#r "Hopac.Platform"
#r "Hopac.Core"
#r "Hopac"
open System.Collections.Generic
open Hopac
#!/usr/bin/env fsharpi
#I "../../.nuget/packages/hopac/0.3.21/lib/net45/"
#r "Hopac.Platform"
#r "Hopac.Core"
#r "Hopac"
open System.Collections.Generic
open Hopac
[<EntryPoint>]
let main argv =
try
match ParseArgs argv with
| Options.NoCommand -> printfn "%s" "Subcommand required!"
| Options.Query o ->
let client = Client.New o.BaseUrl o.Id o.Key
let status = client.q {
let! ticket = client.Query o.Query o.From o.To
let! status = client.WaitOn ticket
open Argu
open Hopac
[<EntryPoint>]
let main argv =
let query = @"_sourceCategory=harbour/container-health"
try
Args("fss", argv)
|> Client.query query
|> Client.send
open Argu
[<EntryPoint>]
let main argv =
try
Args("fss", argv)
|> Client.json "post" @"{ ""foo"": ""bar"" }"
|> Client.send
|> printfn "%s"
with
let cell (x: 'a) : Job<Cell<'a>> = job {
let c = {reqCh = Ch (); replyCh = Ch ()}
let rec server x = job {
let! req = Ch.take c.reqCh
match req with
| Get ->
do! Ch.give c.replyCh x
return! server x
| Put x ->
return! server x
let create (x: 'a) : Job<Cell<'a>> = Job.delay <| fun () ->
let c = {reqCh = Ch (); replyCh = Ch ()}
let rec server x =
Ch.take c.reqCh >>= function
| Get ->
Ch.give c.replyCh x >>=. server x
| Put x -> server x
Job.start (server x) >>-. c
with import <nixpkgs> {};
stdenv.mkDerivation rec {
name = "harbour-cli";
buildInputs = [ git go glide ];
src = ./.;
phases = [ "glidePhase" "testPhase" "buildPhase" ];
token = builtins.getEnv "WORKIVA_PRIVATE_GITHUB_TOKEN";
glidePhase = ''
git config --global url."https://${token}:[email protected]/".insteadOf "https://github.com/";
with import <nixpkgs> {};
stdenv.mkDerivation rec {
name = "harbour-cli";
buildInputs = [ go glide ];
src = ./.;
buildPhase = ''
source $stdenv/setup
echo "what up"
'';