Skip to content
run c/cpp or other language snippet code
Perl 6
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin
lib/App
t
.appveyor.yml
.gitignore
.travis.yml
LICENSE
META6.json
README.adoc

README.adoc

perl-app-snippet

run c/cpp or other language snippet code

Build Status https://ci.appveyor.com/api/projects/status/jxi78155dvv8jrqx?svg=true

Feature

  • Run code from command line arguments

  • Run code input from user

  • compile files and link them to executable binary

  • Preprocess code only

  • Compile code only

  • Code format

TODO

  • Run code grab from web

Language Support

  • c

  • c++

Usage

  • c

    • code snippet

      $ snippet c -e 'int a = 500;'  -e 'a = rand();' -e 'printf("%d\n", a);' -i stdlib.h -p
      --------------------------------------------------
      #include <stdlib.h>
      #include <stdio.h>
      int main(void)
      {
      int a = 500; a = rand(); printf("%d\n", a);
      return 0;
      }
      --------------------------------------------------
      1804289383
    • read from user

      $ snippet c -r
      Please input your code, make sure your code correct.
      Enter @@CODEEND input.
      int main() {
          printf("Hello World!!\n");
      }
      @@CODEEND
      Hello World!!
    • file

      $ snippet c *.c
      Hello World!!
  • cxx

    • code snippet

      $ snippet cpp -e 'int a{500};' -e 'std::random_device rd{};' -e 'std::uniform_int_distribution<int> dist(0, 100000);' -e 'a = dist(rd);' -e 'std::cout <<a << std::endl;' -p -i random
      --------------------------------------------------
      #include <random>
      #include <iostream>
      int main(void)
      {
      int a{500};
      std::random_device rd{};
      std::uniform_int_distribution<int> dist(0, 100000);
      a = dist(rd);
      std::cout <<a << std::endl;
      return 0;
      }
      --------------------------------------------------
      81873
    • read from user

      $ snippet cpp -r -p
      Please input your code, make sure your code correct.
      Enter @@CODEEND input.
      int main() {
          std::cout <<"Hello World" << std::endl;
      }
      @@CODEEND
      --------------------------------------------------
      #include <iostream>
      int main() {
          std::cout <<"Hello World" << std::endl;
      }
      --------------------------------------------------
      Hello World
    • file

      $ snippet cpp *.cpp
      Hello World!!

Installation

zef install App::snippet

License

GPL

Author

araraloren (blackcatoverwall#gmail.com)

You can’t perform that action at this time.