A command line tool to generate sequence diagrams

goseq - text based sequence diagrams

A small command line utility used to generate UML sequence diagrams from a text-base definition file.

Inspired by js-sequence-diagram and websequencediagram.

Install

To install it:

go get github.com/lmika/goseq

To allow automatic generation of PNG files, build with the im tag (ImageMagick is required):

go get -tags im github.com/lmika/goseq

Usage

goseq [FLAGS] FILES ...

Supported flags:

  • -o filename: Specify output filename (either .svg or, if supported, .png)

Sequence Diagrams

goseq generates sequence diagrams from a text files which defines the participants and sequence of actions you want to represent:

Client->Server: Make request
Server->Database: Make database\nrequest
Database->Server: The result
Server->Client: The response

example

Sequence diagrams can also include things like blocks, notes and participant icons:

participant User (icon="human"): The User
participant Client
participant Server
participant Database (icon="cylinder")

User->Client: Clicks button
Client->Server: Make request
Server->Server: Check cache
alt: [response in cache]
    note over Server: Server only caches results\nfor 2 weeks.
    Server->Client: The cached response
else:
    Server->Database: Make database\nrequest
    Database->Server: The result
    Server->Client: The response
end

example2

For details and examples, please see the Language Guide.

Licence

Released under the MIT Licence.

Comments
  • Bug in nested ALT with self referencing

    Bug in nested ALT with self referencing

    This code display nesting normally

    participant User
    participant API
    participant Database (icon="cylinder")
    
    alt: [client is ready]
        API->Database: Send message
        alt: [client has ip address]
            API->Database: Send message2
        end
    end
    

    But when we replace API->Database: Send message2 with API->API: Send message2, nested ALT become bigger than its parent ALT. All code to reproduce a bug:

    participant User
    participant API
    participant Database (icon="cylinder")
    
    alt: [client is ready]
        API->Database: Send message
        alt: [client has ip address]
            API->API: Send message2
        end
    end
    
  • Syntax Error

    Syntax Error

    Hi,

    I am trying the below commands as per READ ME. It is failing for all files with same syntax error.

    >> goseq client/manager.go -o s1.svg
    goseq: client/manager.go - client/manager.go:5: syntax error
    

    Please help me with this.

  • Provide list of icons in README.md file

    Provide list of icons in README.md file

    Problem: Lack of list of available icons Proposition Please provide list of icon="$value" in order to ease the work. Or just point to the file, I was searching like 10 mins and found nothing yet. Gain: It will increase user experience with this library

    Icons I have found

    var builtinIcons = map[string]ActorIcon{
            "human":    &builtinActorIcon{graphbox.StickPersonIcon(1)},
            "cylinder": &builtinActorIcon{graphbox.CylinderIcon(1)},
            "cloud":    &builtinActorIcon{graphbox.PathIcon{graphbox.CloudPathData}},
    }
    
  • Issue #11 - fix full widthing of blocks (alt, loop, etc) instead bound to inner content

    Issue #11 - fix full widthing of blocks (alt, loop, etc) instead bound to inner content

    Fixes #11

    Q: Should I check in the tests/testout.html file as part of the PR? Q: Perhaps it should be flagged behind a --condensed-blocks flag?

    Currently any diagram with several blocks and >5 columns becomes hard to eye parse...

    Screenshot 2020-10-08 at 22 03 26

    ...this PR bounds blocks to the inner (including nested) content...

    Screenshot 2020-10-08 at 22 55 31
    participant One
    participant Two
    participant Three
    participant Four
    participant Five
    participant Six
    participant Seven
    participant Eight
    participant Nine
    participant Ten
    
    One->Two:
    
    loop: loop1
      Two->Three:
      note over Three: woof
      loop: loop2
        Three->Four:
      end
    end
    
    Four->Five:
    
    loop: loop3
      alt: xxx
        Six->Eight: oof
      elsealt: yyy
        Six->Nine: oof
      end
    end
    

    Tests no longer fails (got a div by zero for a while there)

    $ ./runtests.sh
    Test: humanActorStyles.seq
    Test: humanActors.seq
    Test: humanActors2.seq
    Test: offsideActors1.seq
    Test: offsideActors2.seq
    Test: offsideActors3.seq
    Test: offsideActors4.seq
    Test: optblock.seq
    Test: test1.seq
    Test: test2.seq
    Test: test3.seq
    Test: test4.seq
    Test: test5.seq
    Test: test6.seq
    Test: test7.seq
    Test: testComments.seq
    Test: testConcurrent.seq
    Test: testDeepNesting.seq
    Test: testDividers.seq
    Test: testDividersNoText.seq
    Test: testIf.seq
    Test: testIfElse.seq
    Test: testIfSelf.seq
    Test: testLargeObjectNames.seq
    Test: testLoop.seq
    Test: testMultiNotes.seq
    Test: testMultiNotes2.seq
    Test: testNestedIf.seq
    Test: testNoActors.seq
    Test: testNoBottomActors.seq
    Test: testSelfArrows.seq
    Test: testSelfArrows2.seq
    Test: testSmallTitle.seq
    Test: testStyles.seq
    

    But the following look weird... (all (?) fixed now)

    FIXED: Blocks don't align (sibling blocks are not taken into account) and the bottom dotted line is missing from the first block...

    Screenshot 2020-10-08 at 22 30 51 Screenshot 2020-10-08 at 22 48 37

    FIXED: Well this just looks plain odd... but I think it's another case of sibling block sizes not being taken into account...

    Screenshot 2020-10-08 at 22 33 51 Screenshot 2020-10-08 at 22 48 52
  • Packaging as debian package

    Packaging as debian package

    Heya,

    It would be convenient for me if this was installable as a .deb file.

    Would you let me script the generation of the .deb package and send you a pull request?

  • Random sampling vs Wallenius

    Random sampling vs Wallenius

    Hi,

    I would like to understand the difference between Random sampling and Wallenius distribution method. I know it's explained in the manual but I still don't quite get it.

    In our analysis we see more functionally relevant GO terms using the random sampling method vs Wallenius distribution, which gives functionally non-relevant GO terms to our conditions. I would appreciate any inputs.

  • Loop and Alt use the full width instead of only covering the leftmost to rightmost inner columns.

    Loop and Alt use the full width instead of only covering the leftmost to rightmost inner columns.

    If I have 5 columns and a loop around 2 of them the outer box of the loop is the full width of the diagram. I expected it to only cover the leftmost to rightmost of the inner referenced columns. For a diagram with many loops it makes it visually very noisy when all boxes are full width.

    One->Two:
    
    loop: loop1
      Two->Three:
    end
    
    Three->Four:
    Four->Five:
    

    In the above code I would expect the loop to only encompass Two and Three. Instead it is the full width...

    Screenshot 2020-10-08 at 17 28 14

    (Although I'm queueing up a bunch of issues I may take a look at them myself - I just wanted to be able to track and prioritise them)

  • Block Attributes

    Block Attributes

    • Added attributes to block directives — such as alt, loop and opt — which allows for some limited styling options for blocks in generated sequence diagrams. At this stage, the only attribute is full_width, which can be used to control whether a block should span the length of the diagram, or only the length of the actions contained within it.
    • Added the generic block directive, which does no have a leading tag.
  • Add

    Add "-x" as an action type between two actors, to denote message rejection/not accepted

    I am trying to add this feature myself, and I have tried to modify the parser to accept "x" the same way it accepts other actions but still getting a syntax error, which means, I think that I haven't modified the parser correctly. Any hints?

  • Expose font-size as a style

    Expose font-size as a style

    Expose the font-size used by participants and actions as a style attribute.

    Example usage:

    style participant (
        fontsize = 10
    )
    
    style action (
        fontsize = 8
    )
    

    Should be supported by:

    • titles
    • participants
    • actions
    • notes

    To check: can style attribute names have dashes? font-size will be a better name.

  • Concurrent actions are introducing too much space

    Concurrent actions are introducing too much space

    When using concurrent actions, too much space is being added to the actions that appear in the activity first. This is because the layout in "activityline.go" is AddSizeConstraint instead of just general SizeConstraint with a decent enough padding.

    See "testConcurrent.seq".

Related tags
I'm sick. And... fibonacci sequence.
I'm sick. And... fibonacci sequence.

Fibonacci Sequence Like I said, Fibonnaci Sequence. Be happy that I didn't make any more fuss about this "achievement" (it's not, for anyone) Source c

Oct 18, 2021
A Github action to check if IDT could synthesize a given DNA sequence.

dna-is-synthesizable A github action to check if a part is synthesizable from a given Genbank file. dna-is-synthesizable is a Github Action that recei

Oct 28, 2021
seqinfo gathers image sequence info from directories.

seqinfo seqinfo gathers info from sequences in directories, and prints or writes it to an excel file. Usage seqinfo /path/to/search/sequences For adv

Dec 23, 2021
Snowflake algorithm generation worker Id sequence

sequence snowflake algorithm generation worker Id sequence 使用雪花算法生成ID,生成100万个只需要

Jan 21, 2022
Package reservoir samples values uniformly at random from an unbounded sequence of inputs

Package reservoir samples values uniformly at random from an unbounded sequence of inputs

Oct 5, 2022
A command-line tool that triggers command when the input (doesn't) comes from STDIN in an interval.

conk A command-line tool that triggers command when the input (doesn't) comes from STDIN in an interval. Usage $ conk -h A command-line tool that trig

Apr 29, 2022
Go package and associated command line utility to generate random yet human-readable names and identifiers
Go package and associated command line utility to generate random yet human-readable names and identifiers

namegen | What's this? Go package and associated command line utility to generate random yet human-readable names and identifiers. Somewhat inspired b

Oct 19, 2022
Wordle - Wordle on command line

wordle Play WORDLE on the command line. Installation go install github.com/howey

May 19, 2022
The command-line client for Cloudflare Tunnel

Cloudflare Tunnel client Contains the command-line client for Cloudflare Tunnel, a tunneling daemon that proxies traffic from the Cloudflare network t

Feb 10, 2022
Ghdl - A much more convenient way to download GitHub release binaries on the command line, works on Win & Unix-like systems

ghdl Memorize ghdl as github download ghdl is a fast and simple program (and als

Oct 12, 2022
A tool to generate Pulumi Package schemas from Go type definitions

MkSchema A tool to generate Pulumi Package schemas from Go type definitions. This tool translates annotated Go files into Pulumi component schema meta

Sep 1, 2022
CLI tool to generate preview images from a zmk .keymap file
CLI tool to generate preview images from a zmk .keymap file

ZMK viewer A work in progress Cli tool to generate preview images from a zmk .keymap file. Installation You can download a pre compiled binary directl

Jan 3, 2023
HTTP service to generate PDF from Json requests

pdfgen HTTP service to generate PDF from Json requests Install and run The recommended method is to use the docker container by mounting your template

Dec 2, 2022
Automatically generate Go test boilerplate from your source code.
Automatically generate Go test boilerplate from your source code.

gotests gotests makes writing Go tests easy. It's a Golang commandline tool that generates table driven tests based on its target source files' functi

Jan 3, 2023
generate fake data in go

Faker for Go Usage package main import ( "github.com/manveru/faker" ) func main() { fake, err := faker.New("en") if err != nil { panic(err

Sep 29, 2022
:runner:runs go generate recursively on a specified path or environment variable and can filter by regex

Package generate Package generate runs go generate recursively on a specified path or environment variable like $GOPATH and can filter by regex Why wo

Sep 27, 2022
generate my_github status using GitHub Actions
generate my_github status using GitHub Actions

generate my_github status using GitHub Actions

Sep 21, 2022
Generate spreadsheets based on GitHub contributions

pullsheet generates a CSV (comma separated values) & HTML output about GitHub activity across a series of repositories.

Oct 17, 2022
Generate type-safe Go converters by simply defining an interface

goverter a "type-safe Go converter" generator goverter is a tool for creating type-safe converters. All you have to do is create an interface and exec

Jan 4, 2023