Code Monkey home page Code Monkey logo

moped's Introduction

Moped - build command-line interfaces with Scala 🛵

moped's People

Contributors

ckipp01 avatar duhemm avatar keynmol avatar olafurpg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

moped's Issues

Surprising levenshtein distance suggestion

Describe the bug

[info] error: found argument '--sourcegraph-endpoing' which wasn't expected, or isn't valid in this context.
[info] 	Did you mean '--app'?

Expected behavior

[info] error: found argument '--sourcegraph-endpoing' which wasn't expected, or isn't valid in this context.
- [info] 	Did you mean '--app'?
+ [info] 	Did you mean '--sourcegraph-endpoint'?

Add support for enums

Describe the bug

It would be nice if there was a low-ceremony solution to have enum fields. For example,

sealed abstract class Day
case object Monday extends Day
case object Sunday extends Day
case class MyCommand(day: Day = Monday) extends Command

// --day=sunday works as expected

Add support for Scala 3

Currently, Moped doesn't work with Scala 3 because it uses the Scala 2 macro API to generate decoders. It should be possible to implement the same macros for Scala 3

Failing to parse int flag

Describe the bug

To Reproduce Steps to reproduce the behavior:

Define a command with an Int field port

case class PackageServer(
    store: PackageStore = new InMemoryPackageStore,
    port: Int = 8080,

Run the command with a custom port argument

[info] running (fork) com.sourcegraph.package_server.PackageServer --port 4040
[info] error: Type mismatch at '.port';
[info]   found    : String
[info]   expected : Int

Expected behavior

It parses the port as 4040 instead of reporting an error.

Support -version and --version

To Reproduce Steps to reproduce the behavior:

❯ lsif-java --version
error: no such subcommand '--version'.
	Did you mean 'lsif-java version'?
	Try 'lsif-java help' for more information.

Expected behavior

❯ lsif-java --version
0.4.0

[Security] Workflow release.yml is using vulnerable action actions/checkout

The workflow release.yml is referencing action actions/checkout using references v1. However this reference is missing the commit a6747255bd19d7a757dbdda8c654a9f84db19839 which may contain fix to the some vulnerability.
The vulnerability fix that is missing by actions version could be related to:
(1) CVE fix
(2) upgrade of vulnerable dependency
(3) fix to secret leak and others.
Please consider to update the reference to the action.

Display `--no-` prefix in help messages

Describe the bug

The --no- prefix is not discoverable.

To Reproduce Steps to reproduce the behavior:

Run --help on a moped app with a cleanup: Boolean field.

  --cleanup: Boolean = true    Whether to remove generated temporary files on exit.

Expected behavior

The help message should be something like this instead

  --no-cleanup               Whether to remove generated temporary files on exit.

The --cleanup flag is enabled by default so maybe it's not necessary to include it in the output 🤔

Install completions

❯ cat ~/.config/fish/functions/tests.fish
function _tests
   set -l arguments (commandline -poc)
   set -l current (commandline -ct)
   tests complete fish $arguments $current 2> ~/.dump
end
complete -f -c tests -a "(_tests)"

moped on 🌱 start
❯ cat ~/.bash/complete/_tests
_tests() {
  completions=$(tests complete bash ${#COMP_WORDS[@]} ${COMP_WORDS[@]} 2> ~/.dump)
  cur="${COMP_WORDS[COMP_CWORD]}"
  COMPREPLY=($(compgen -W "$completions" -- $cur))
  return 0
}
complete -F _tests tests

moped on 🌱 start
❯ cat ~/.zsh/completion/_tests
#compdef _tests tests


function _tests {
    compadd -- $(tests complete zsh $CURRENT $words[@] 2> /dev/null)
}

Support nested Option fields

Describe the bug

I'm not able to declare a nested field within an Option[T]

To Reproduce Steps to reproduce the behavior:

case class MyCommand(
  db: Option[Database] = None
)
case class Database(username: String)

Running --db.username=foo fails

[info] error: found argument '--db.username' which wasn't expected, or isn't valid in this context.

Expected behavior

Running --db.username=foo should work.

Testkit should make it easy to provide a custom temporary directory

Describe the bug

Testkit currently uses Files.createTemporaryDirectory(), which creates /var/file/... paths on macOS that are mirrored under /private/var/file/... and can cause tests to fail.

Expected behavior

I'm able to work around this issue with

  override val temporaryDirectory: DirectoryFixture =
    new DirectoryFixture {
      private val path = BuildInfo.temporaryDirectory.toPath
      override def apply(): Path = path
      override def beforeAll(): Unit = {}
      override def afterEach(context: AfterEach): Unit = {
        DeleteVisitor.deleteRecursively(path)
      }
    }

it would be nice if there was an easy way to override the Files.createTemporaryDirectory() method call.

NotImplementedError in JsonBuilder.scala:34

❯ lsif-java index
java.util.concurrent.ExecutionException: Boxed Exception
	at scala.concurrent.impl.Promise$.scala$concurrent$impl$Promise$$resolve(Promise.scala:99)
	at scala.concurrent.impl.Promise$Transformation.handleFailure(Promise.scala:408)
	at scala.concurrent.impl.Promise$Transformation.run(Promise.scala:470)
	at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1426)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
Caused by: scala.NotImplementedError: an implementation is missing
	at scala.Predef$.$qmark$qmark$qmark(Predef.scala:344)
	at moped.json.PrimitiveBuilder.addObjectMember(JsonBuilder.scala:34)
	at moped.json.ObjectMergerTraverser.traverseMember(ObjectMergerTraverser.scala:41)
	at moped.json.JsonTraverser.$anonfun$traverseObject$1(JsonTraverser.scala:52)
	at moped.json.JsonTraverser.$anonfun$traverseObject$1$adapted(JsonTraverser.scala:51)
	at scala.collection.immutable.List.foreach(List.scala:333)
	at moped.json.JsonTraverser.traverseObject(JsonTraverser.scala:51)
	at moped.json.ObjectMergerTraverser.traverseObject(ObjectMergerTraverser.scala:37)
	at moped.json.JsonTraverser.traverse(JsonTraverser.scala:12)
	at moped.json.JsonTraverser.traverse(JsonTraverser.scala:4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.