diff options
| author | Ruben Beltran del Rio <jj@r.bdr.sh> | 2025-12-17 10:51:26 +0100 |
|---|---|---|
| committer | Ruben Beltran del Rio <jj@r.bdr.sh> | 2025-12-17 10:52:47 +0100 |
| commit | c593918dd9df53d12c4664677f50aacdba6cfbb1 (patch) | |
| tree | 0c84de3e7922793fb93f28a329e3d39a510431d9 | |
| parent | 1ddc6a781ccc46c8b6fe8d4309347221e3f878ac (diff) | |
Update readme, add version command
| -rw-r--r-- | README.md | 45 | ||||
| -rw-r--r-- | src/main.rs | 31 |
2 files changed, 73 insertions, 3 deletions
@@ -4,7 +4,50 @@ Command line tool to generate wardley map images from wmap files. ## How to use -TBD +### Synopsis + +``` +wmap [OPTIONS] INPUT_FILE +``` + +### Description + +wmap is a tool that lets you create png or svg images from a wmap formatted file. + +### Options + +- **-h, --help**: Display help. +- **-v, --version**: Display version information. +- **-t, --type <IMAGE_TYPE>**: Specifies the output type. Can be one of: `png`, or `svg`. Defaults to `png`. +- **-s, --stage <STAGE>**: Specifies the stage labels to use. Defaults to `activities`. +- **-o, --output <OUTPUT_FILE>**: The output file in which to write the image. Defaults to the same filename as the input map, but replacing the extension with either `png`, or `svg`. + +### Stages + +The renderer has the following built-in stage types available: + +- **activities** - Genesis / Custom / Product (+rental) / Commodity (+utility) +- **behavior** - Uncertain when to use / Learning when to use / Learning through use / Known / common usage +- **certainty** - Poorly Understood / exploring the unknown / Rapid Increase In Learning / discovery becomes refining / Rapid increase in use / increasing fit for purpose / Commonly understood (in terms of use) +- **comparison** - Constantly changing / a differential / unstable / Learning from others / testing the water / some evidential support / Competing models / feature difference / evidential support / Essential / any advantage is operational / accepted norm +- **cynefin** - Chaotic / Complex / Complicated / Clear +- **data** - Unmodelled / Divergent / Convergent / Modelled +- **decision_drivers** - Heritage / culture / Analyses & synthesis / Analyses & synthesis / Previous Experience +- **efficiency** - Reducing the cost of change (experimentation) / Reducing cost of waste (Learning) / Reducing cost of waste (Learning) / Reducing cost of deviation (Volume) +- **failure** - High / tolerated / assumed to be wrong / Moderate / unsurprising if wrong but disappointed / Not tolerated / focus on constant improvement / assumed to be in the right direction / resistance to changing the model / Surprised by failure / focus on operational efficiency +- **focus_of_value** - High future worth but immediate investment / Seeking ways to profit and a ROI / seeking confirmation of value / High profitability per unit / a valuable model / a feeling of understanding / focus on exploitation / High volume / reducing margin / important but invisible / an essential component of something more complex +- **knowledge** - Concept / Hypothesis / Theory / Accepted +- **knowledge_management** - Uncertain / Learning on use / focused on testing prediction / Learning on operation / using prediction / verification / Known / accepted +- **market** - Undefined Market / Forming Market / an array of competing forms and models of understanding / Growing Market / consolidation to a few competing but more accepted forms / Mature Market / stabilised to an accepted form +- **market_action** - Gambling / driven by gut / Exploring a "found" value / Market analysis / listening to customers / Metric driven / build what is needed +- **market_perception** - Chaotic (non-linear) / domain of the "crazy" / Domain of "experts" / Increasing expectation of use / domain of "professionals" / Ordered (appearance of being linear) / trivial / formula to be applied +- **perception_in_industry** - Future source of competitive advantage / unpredictable / unknown / Seen as a scompetitive advantage / a differential / ROI / case examples / Advantage through implementation / features / this model is better than that / Cost of doing business / accepted / specific defined models +- **practice** - Novel / Emerging / Good / Best +- **publication** - Describe the wonder of the thing / the discovery of some marvel / a new land / an unknown frontier / Focused on build / construct / awareness and learning / many models of explanation / no accepted forms / a wild west / Maintenance / operations / installation / comparison between competing forms / feature analysis / Focused on use / increasingly an accepted, almost invisible component +- **ubiquity** - Rare / Slowly Increasing / Rapidly Increasing / Widespread in the applicable market / ecosystem +- **understanding** - Poorly Understood / unpredictable / Increasing understanding / development of measures / Increasing education / constant refinement of needs / measures / Believed to be well defined / stable / measurable +- **user_perception** - Different / confusing / exciting / surprising / dangerous / Leading edge / emerging / unceirtanty over results / Increasingly common / disappointed if not used or available / feeling left behind / Standard / expected / feeling of shock if not used +- **evolution_stage** - Stage I / Stage II / Stage III / Stage IV # Building diff --git a/src/main.rs b/src/main.rs index c6201db..833c846 100644 --- a/src/main.rs +++ b/src/main.rs @@ -77,6 +77,10 @@ struct Arguments { image_type: ImageType, } +fn print_help() { + println!("Usage: wmap [-t|--type IMAGE_TYPE] [-s|--stage STAGE] [-o|--output OUTPUT_FILE] INPUT_FILE"); +} + fn parse_arguments() -> Result<Arguments, lexopt::Error> { use lexopt::prelude::*; @@ -102,7 +106,12 @@ fn parse_arguments() -> Result<Arguments, lexopt::Error> { input = Some(value.string()?); } Short('h') | Long("help") => { - println!("Usage: wmap [-t|--type=png|svg] [-o=OUTPUT_FILE] INPUT_FILE"); + print_help(); + std::process::exit(0); + } + Short('v') | Long("version") => { + let version = env!("CARGO_PKG_VERSION"); + println!("{version}"); std::process::exit(0); } _ => return Err(argument.unexpected()), @@ -123,7 +132,7 @@ fn parse_arguments() -> Result<Arguments, lexopt::Error> { }) } -fn main() -> IoResult<()> { +fn run() -> IoResult<()> { let arguments = parse_arguments().map_err(|_| IoError::other("Unable to parse arguments"))?; arguments.input.try_exists()?; @@ -141,3 +150,21 @@ fn main() -> IoResult<()> { write(arguments.output, image_data)?; Ok(()) } + +fn main() -> IoResult<()> { + let result = run(); + + if cfg!(debug_assertions) { + result + } else { + match result { + Ok(()) => Ok(()), + Err(e) => { + eprintln!("Error: {e}"); + eprintln!(); + print_help(); + std::process::exit(1); + } + } + } +} |