Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. The Weird and The Wonderful
  4. Not 'Clap' but 'CLAP', dammit.

Not 'Clap' but 'CLAP', dammit.

Scheduled Pinned Locked Moved The Weird and The Wonderful
helpcomdockerquestionannouncement
8 Posts 6 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    Brady Kelly
    wrote on last edited by
    #1

    I'm trying out various command line option parser libraries, and those with verb or command options are few and far between. CLAP[^] is one that handles verbs, e.g. I don't need a separate Console application for each task, where the CLI library just parses the options for that command. I want a library where I can have one Console app, which accepts a command/verb and the options for that verb get parsed. So far I've found only CLAP and ManyConsole[^]. E.g. I don't want to have to have import.exe filename [-repeat] but I want console.exe import filename [-repeat]. So I built a console application called Clap, with this code:

    using System;
    using CLAP;

    namespace Clap
    {
    class Program
    {
    static void Main(string[] args)
    {
    Parser.Run<Program>(args);
    }

        \[Verb(Description = "Imports an Impro CSV report file.", Aliases = "import,imp")\]
        static void ImportCsv(
            \[Required\]
            \[Description("Full path to the file to import.")\] string filePath)
        {
            Console.WriteLine("Will import " + filePath);
        }
    }
    

    }

    When I run the application with clap /? or clap import xxx, I get the error message

    Unhandled Exception: System.TypeLoadException: Could not load type 'CLAP.Parser' from assembly 'Clap, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
    at Clap.Program.Main(String[] args)

    Google provided zero leads, so the problem was not well known. Well, how well known is CLAP itself? The Version-=1.0.0.0 gave me the key clue. It looked like the app was trying to load CLAP.Parser from my Clap assembly, not the CLAP library assembly, which is version 4.3. All it took was to change my assembly name and default namespace to ClapCli and the problem vanished, but just BTW, CLAP is very, very thin. It throws exceptions when verbs arguments are omitted, and expects you to decorate a method to do something with the exception. It also has no built in help provider, and requires you to decorate a method that is called when the user requests help. You must compose and format your own

    D B H 3 Replies Last reply
    0
    • B Brady Kelly

      I'm trying out various command line option parser libraries, and those with verb or command options are few and far between. CLAP[^] is one that handles verbs, e.g. I don't need a separate Console application for each task, where the CLI library just parses the options for that command. I want a library where I can have one Console app, which accepts a command/verb and the options for that verb get parsed. So far I've found only CLAP and ManyConsole[^]. E.g. I don't want to have to have import.exe filename [-repeat] but I want console.exe import filename [-repeat]. So I built a console application called Clap, with this code:

      using System;
      using CLAP;

      namespace Clap
      {
      class Program
      {
      static void Main(string[] args)
      {
      Parser.Run<Program>(args);
      }

          \[Verb(Description = "Imports an Impro CSV report file.", Aliases = "import,imp")\]
          static void ImportCsv(
              \[Required\]
              \[Description("Full path to the file to import.")\] string filePath)
          {
              Console.WriteLine("Will import " + filePath);
          }
      }
      

      }

      When I run the application with clap /? or clap import xxx, I get the error message

      Unhandled Exception: System.TypeLoadException: Could not load type 'CLAP.Parser' from assembly 'Clap, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
      at Clap.Program.Main(String[] args)

      Google provided zero leads, so the problem was not well known. Well, how well known is CLAP itself? The Version-=1.0.0.0 gave me the key clue. It looked like the app was trying to load CLAP.Parser from my Clap assembly, not the CLAP library assembly, which is version 4.3. All it took was to change my assembly name and default namespace to ClapCli and the problem vanished, but just BTW, CLAP is very, very thin. It throws exceptions when verbs arguments are omitted, and expects you to decorate a method to do something with the exception. It also has no built in help provider, and requires you to decorate a method that is called when the user requests help. You must compose and format your own

      D Offline
      D Offline
      dusty_dex
      wrote on last edited by
      #2

      If you look at one of the examples you'll find this:

      using CLAP;
      using CLAP.Validation;

      // and a class with methods
      class ClapApp
      {
      .
      .
      .
      }

      :) > "Well, how well known is CLAP itself? " :laugh:

      "It's true that hard work never killed anyone. But I figure, why take the chance." - Ronald Reagan That's what machines are for. Got a problem? Sleep on it.

      B 1 Reply Last reply
      0
      • D dusty_dex

        If you look at one of the examples you'll find this:

        using CLAP;
        using CLAP.Validation;

        // and a class with methods
        class ClapApp
        {
        .
        .
        .
        }

        :) > "Well, how well known is CLAP itself? " :laugh:

        "It's true that hard work never killed anyone. But I figure, why take the chance." - Ronald Reagan That's what machines are for. Got a problem? Sleep on it.

        B Offline
        B Offline
        Brady Kelly
        wrote on last edited by
        #3

        I just changed my app name from 'Clap' to 'ClapCli' and it was fixed. See the last paragraph, that I've just added.

        H 1 Reply Last reply
        0
        • B Brady Kelly

          I'm trying out various command line option parser libraries, and those with verb or command options are few and far between. CLAP[^] is one that handles verbs, e.g. I don't need a separate Console application for each task, where the CLI library just parses the options for that command. I want a library where I can have one Console app, which accepts a command/verb and the options for that verb get parsed. So far I've found only CLAP and ManyConsole[^]. E.g. I don't want to have to have import.exe filename [-repeat] but I want console.exe import filename [-repeat]. So I built a console application called Clap, with this code:

          using System;
          using CLAP;

          namespace Clap
          {
          class Program
          {
          static void Main(string[] args)
          {
          Parser.Run<Program>(args);
          }

              \[Verb(Description = "Imports an Impro CSV report file.", Aliases = "import,imp")\]
              static void ImportCsv(
                  \[Required\]
                  \[Description("Full path to the file to import.")\] string filePath)
              {
                  Console.WriteLine("Will import " + filePath);
              }
          }
          

          }

          When I run the application with clap /? or clap import xxx, I get the error message

          Unhandled Exception: System.TypeLoadException: Could not load type 'CLAP.Parser' from assembly 'Clap, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
          at Clap.Program.Main(String[] args)

          Google provided zero leads, so the problem was not well known. Well, how well known is CLAP itself? The Version-=1.0.0.0 gave me the key clue. It looked like the app was trying to load CLAP.Parser from my Clap assembly, not the CLAP library assembly, which is version 4.3. All it took was to change my assembly name and default namespace to ClapCli and the problem vanished, but just BTW, CLAP is very, very thin. It throws exceptions when verbs arguments are omitted, and expects you to decorate a method to do something with the exception. It also has no built in help provider, and requires you to decorate a method that is called when the user requests help. You must compose and format your own

          B Offline
          B Offline
          Brisingr Aerowing
          wrote on last edited by
          #4

          How's this one[^]? It handles verbs as well, and allows you to not use them as well.

          Gryphons Are Awesome! ‮Gryphons Are Awesome!‬

          B 1 Reply Last reply
          0
          • B Brisingr Aerowing

            How's this one[^]? It handles verbs as well, and allows you to not use them as well.

            Gryphons Are Awesome! ‮Gryphons Are Awesome!‬

            B Offline
            B Offline
            Brady Kelly
            wrote on last edited by
            #5

            That ended up my second choice, but ManyConsole won, with better automatic help for available verbs and their options.

            1 Reply Last reply
            0
            • B Brady Kelly

              I just changed my app name from 'Clap' to 'ClapCli' and it was fixed. See the last paragraph, that I've just added.

              H Offline
              H Offline
              H Brydon
              wrote on last edited by
              #6

              Your code is like a dose of clap. Errr no, Clap. No, CLAP!

              -- Harvey

              1 Reply Last reply
              0
              • B Brady Kelly

                I'm trying out various command line option parser libraries, and those with verb or command options are few and far between. CLAP[^] is one that handles verbs, e.g. I don't need a separate Console application for each task, where the CLI library just parses the options for that command. I want a library where I can have one Console app, which accepts a command/verb and the options for that verb get parsed. So far I've found only CLAP and ManyConsole[^]. E.g. I don't want to have to have import.exe filename [-repeat] but I want console.exe import filename [-repeat]. So I built a console application called Clap, with this code:

                using System;
                using CLAP;

                namespace Clap
                {
                class Program
                {
                static void Main(string[] args)
                {
                Parser.Run<Program>(args);
                }

                    \[Verb(Description = "Imports an Impro CSV report file.", Aliases = "import,imp")\]
                    static void ImportCsv(
                        \[Required\]
                        \[Description("Full path to the file to import.")\] string filePath)
                    {
                        Console.WriteLine("Will import " + filePath);
                    }
                }
                

                }

                When I run the application with clap /? or clap import xxx, I get the error message

                Unhandled Exception: System.TypeLoadException: Could not load type 'CLAP.Parser' from assembly 'Clap, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
                at Clap.Program.Main(String[] args)

                Google provided zero leads, so the problem was not well known. Well, how well known is CLAP itself? The Version-=1.0.0.0 gave me the key clue. It looked like the app was trying to load CLAP.Parser from my Clap assembly, not the CLAP library assembly, which is version 4.3. All it took was to change my assembly name and default namespace to ClapCli and the problem vanished, but just BTW, CLAP is very, very thin. It throws exceptions when verbs arguments are omitted, and expects you to decorate a method to do something with the exception. It also has no built in help provider, and requires you to decorate a method that is called when the user requests help. You must compose and format your own

                H Offline
                H Offline
                hvanzyll
                wrote on last edited by
                #7

                I think you need a virus checker on that... your code has the clap. :laugh:

                R 1 Reply Last reply
                0
                • H hvanzyll

                  I think you need a virus checker on that... your code has the clap. :laugh:

                  R Offline
                  R Offline
                  Rob Grainger
                  wrote on last edited by
                  #8

                  Not to be pedantic, but I think you'll find the clap is a bacterial infection. (Just don't ask how I became an expert ;-))

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups