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

Using the Coliru API #5

Open
JohannesMP opened this issue Oct 31, 2017 · 3 comments
Open

Using the Coliru API #5

JohannesMP opened this issue Oct 31, 2017 · 3 comments

Comments

@JohannesMP
Copy link

JohannesMP commented Oct 31, 2017

Not so much an issue as a thank you to StackedCrooked!


I'm working on a personal portfolio site with C++ snippets, which generally are in the form of a header-only library and a driver that demonstrates how the library works. I wanted to not only allow users to view the code, but also run it to verify that it works.

After a lot of digging through several online compilers that either don't allow embedding, external code, or multiple files, I stumbled on Coliru's API in the FAQ.

A few hours later I had smashed together a rough prototype for a Multi-file C++ compiler Frontend using CodeMirror , which can now be found at compile.johannesmp.com:

I'm happy with how functional it is, even if some of the code now should really be cleaned up -- it was less than a day's work after all. Currently scrolling is a bit wonky and it can bug out occasionally when adding/removing files repeatedly.

Since the Coliru API only supports a single source file (which will default to main.cpp), I ended up echoing out each file in the cmd argument instead, to allow for file includes. To be clear: I only plan to use this for my own occasional testing, and to run code samples in my portfolio, mainly intended for potential employers.

There are also lots of small improvements that are still needed (destructive action confirmations, a more user-friendly way to input the compile args, output error syntax highlighting, etc.). My code samples are currently already stored as separate files in gists, so when I next have time I will try to use the gist API so that files can be loaded from, and saved to gists directly.


My only feedback here would be that it would be nice if the Coliru API allowed for multiple files so I wouldn't have to use such a workaround. It is honestly incredible how flexible Coliru is with the command line to even make this possible.

Alternatively, it would be really useful if the API supported gists. That way, it could use the revision to cache the files, so that subsequent runs don't have to re-download and take up more storage.

Once again though, my sincere thanks to StackedCrooked for making Coliru available to us.

@JohannesMP JohannesMP changed the title using coliru API Using the Coliru API Oct 31, 2017
@StackedCrooked
Copy link
Owner

Thanks for the feedback. I agree the current way to have multiple files is rather clumsy, but I haven't really thought of a better way yet.

Glad too read that you found the command line feature very flexible. That was the original intention after all :)

@JohannesMP JohannesMP mentioned this issue Apr 9, 2018
Closed
@tbfe-de
Copy link

tbfe-de commented Sep 26, 2019

I came up with an alternative technique to compile "small multi-file projects" with Coliru.
No special web-frontend required … just convert a local "Makefile project" with a single command.
For details see http://coliru.stacked-crooked.com/a/d7569e58e2ca6bad

@StackedCrooked
Copy link
Owner

StackedCrooked commented Sep 27, 2019 via email

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

No branches or pull requests

3 participants