Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command-line options and snap packaging #18

Closed
wants to merge 1 commit into from
Closed

Conversation

cmars
Copy link

@cmars cmars commented Oct 2, 2016

I was pretty interested in this project after learning about it last week on HN, but I wasn't really set up for .NET/C# development, and I don't run Windows.

My C# is pretty rusty, but I've added command-line options with NDesk.Options, and a Makefile for building on Linux with Mono. Apologies in advance that my C# style could be pretty bad -- I haven't done .NET in years.

For the community interested in this project, I've also added snap packaging (see snapcraft.yaml) in this PR, so that you can just install it on Linux OSes. I've published this package under my namespace as wfc-cmars. On Ubuntu 16.04, you can install with sudo snap install wfc-cmars, and then you'll be able to run with wfc-cmars. For example:

$ wfc-cmars --help
Usage: wfc [OPTIONS]
Bitmap & tilemap generation from a single example with the help of ideas from quantum mechanics.

Options:
      --samples-from=FILE    Process samples from XML FILE. All other options
                               ignored.
  -i, --input=PATH           Input PATH: BMP image for --model=overlapping;
                               directory containing data.xml for --model=
                               simpletiled
  -o, --output=FILE          Output FILE, default=out.bmp
  -w, --width=INT            Tiled image width INT when --model=simpletiled,
                               default=48
  -h, --height=INT           Tiled image height INT when --model=simpletiled,
                               default=48
  -m, --model=TYPE           Model TYPE: `overlapping` (default) or `
                               simpletiled`. Required.
  -n=N                       N parameter, when --model=overlapping, default=2
      --limit=INT            Model limit INT, default=0
  -p, --periodic             Periodic, default false
      --symmetry=INT         Symmetry INT, when --model=overlapping, default=8
      --foundation=INT       Foundation INT, when --model=overlapping, default=0
      --pi, --periodicInput=BOOL
                             Periodic input BOOL, when --model=overlapping,
                               default=True
      --subset=NAME          Subset NAME in data.xml, when --model=simpletiled
      --black=VALUE          Black, when --model=simpletiled, default false
      --help                 Display help and exit
$ wfc-cmars -i samples/City.bmp -n 3 --symmetry 2 --foundation=-2 --periodic -o test.png
DONE

Snap packages support most or all Linux distributions, see http://snapcraft.io for instructions on installing the snap command if you don't have it.

Hope this is helpful, and thanks for this amazing fun project!

@mxgmn
Copy link
Owner

mxgmn commented Oct 5, 2016

@cmars You're welcome and thanks for the PR! I'll keep it open so people could start faster with the command line.

@cmars
Copy link
Author

cmars commented Oct 5, 2016

Rebased to master

@VelocityRa
Copy link

Is this going to get merged?

@mxgmn
Copy link
Owner

mxgmn commented Oct 9, 2016

@VelocityRa No. But you can merge it in your fork.

@VelocityRa
Copy link

Oh, alright.

@cmars cmars closed this Nov 15, 2017
@Nakilon
Copy link

Nakilon commented Jul 3, 2021

I have no clue in snap and dotnet. How do I install it?

$ docker run --rm -ti snapcore/snapcraft
# sudo snap install wfc-cmars
error: cannot communicate with server: Post http://localhost/v2/snaps/wfc-cmars: dial unix /run/snapd.socket: connect: no such file or directory

@cmars
Copy link
Author

cmars commented Jul 4, 2021

Snaps are kind of awkward in that they only work with a live snapd agent running -- which doesn't easily work inside a Docker container. A Dockerfile + wrapper script might be a lot more portable than a snap...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants