Git Product home page Git Product logo

command-center's People

Contributors

davewm avatar duester avatar gkhotyan avatar reibitto avatar scala-steward avatar tuleism avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar

command-center's Issues

All command names should be customizable

Right now commandNames is hardcoded inside the class itself:

val commandNames: List[String] = List("exit", "quit")

It would be better if it were a field of the case class instead.

Then each Decoder instance would need to change to look for commandNames in application.conf.

It would be fine to keep the default names if the field is left off completely. The point of this change is that it gives you the capability to rename anything.

Possible Calculator enhancements

  • Might want to display integer values as 1 instead of 1.0 and so on.
  • Decimal separator could be based on the user's locale. For example, some countries use , instead of .
  • Similar to the above, but also one for grouping separator.
  • Maybe even make these formatting options a config value.
  • Additional functions: log2, ln, ceil, floor
  • Is there value in using BigDecimal instead of Double as the base type?

Unit converter

For converting things like kg/lbs, cm/feet, etc.

You can take a look at how TemperatureCommand is implemented. We could generalize that so it works with all kinds units, not just temperature.

If there are 3rd-party JVM solutions for this, that would also be an option. We would then just need to wrap it.

Maven search command

To be able to quickly pull the latest version of a dependency into your clipboard and so on. Might be nice to also have a view that shows the transitive dependencies.

Prevent duplicate results from showing up

This is rare, but it can happen in certain cases. I think the cause is when you set an alias that is the prefix of that same command. For example:

duplicate

This is because the config is:

aliases {
  "epoch" = ["epochunix", "epochmillis"]
}

Both the alias and the prefix of the command is being matched.

Randomize MAC address command

Reference: http://www.packal.org/workflow/random-mac

Just use rmac to generate and apply a new MAC address. This can be useful when traveling, using free wifi, or troubleshooting a router. If you need an interface other than en0, just edit the script, it's very simple.

We can make the interface part an arg. But en0 is a fine default.

Add command history

Similar to how you can scroll up and down in your history in the command line, you should be able to do the same in Command Center.

Things to keep in mind:

  • Up/down arrow keys are already used for scrolling through results. We'll likely need to come up with different key combinations for this. Of course making it configurable.
  • ctrl+R recursive search
  • Might want to create a cache/persistent storage ZIO Reader/Environment as part of this issue. Edit: The cache part of this is done now.

Render each command asynchronously

Right now when the user inputs text, all commands are run against that text and the results are collected in one go. This means if there's 1 slow command, it'll hold up the results from rendering until it's done.

What really should be done is to make each command result render independently. To make this efficient, debounce it so that we don't call render a ridiculous amount of times. Most commands will complete within a couple of milliseconds anyway, so only a small waitTime on the debounce should be needed.

Make commands more discoverable

I was thinking it might be nice if more of the available commands showed up at the bottom of the results list (i.e. giving it a low score) rather than hiding them completely. Though maybe this should be a configurable option in case you want the results pane to be as small as possible.

External plugin install/uninstall command

I want to be able to install external plugins with a single command like install plugin-name.

I think we should maintain a list of "verified" plugins. But you should also be able to install unverified plugins by URL and file path. Should probably pop up a security warning for the latter case though.

This is a difficult task and I don't recommend tackling it just yet. But it's something that I eventually want.

Add timeout to commands

If a command is taking too long for whatever reason, we should probably cancel it (with a configurable timeout) to minimize delay and save resources.

There aren't many commands that have the potential to run too long yet, but this feature is something that will see more use in the future. Currently there's only 1 command that makes an HTTP request.

Dictionary command

I'm imagining the usage being like "define WORD". Some operating systems have built-in dictionaries (like macOS). I'm not sure if those are usable or not. Or do we have to use an online API instead?

Emoji search command

A command for searching emojis by name and then copying it into your clipboard.

Fix cli-client native-image build

Graal native-image for the cli-client was working until async-http-client-backend-zio was added. It has to do with the netty dependency. I tried fixing it, but no luck so far. Making netty work with native-image appears to be super complicated.

If this can't be fixed, maybe we should try a different backend. But there doesn't appear to be a compatable ZIO backend at the moment. Maybe we can add one to sttp. Such as a OkHttpZIOBackend?
https://sttp.softwaremill.com/en/latest/backends/summary.html

Add Google Translate Command

Here's a reference to one implementation:
http://www.wox.one/plugin/60

In addition to this, there is an opportunity to integrate the auto language detection (which I barely started here). It might also help to have a config option for the languages you use (or are learning) and use that to improve auto-detection. For example, if I have languages = ["en", "ja"] set then it should automatically know to translate to English by default if I type Japanese text.

Allow multiple output for a single command

Currently, one command can only shows only one output, even though it may have a list:

        .sortBy(_.score)(Ordering.Double.TotalOrdering.reverse)
        .distinctBy(_.source)

One possible way to do it is:

  • groupBy(_.source).
  • Sort by score descending, using the highest score within a group.
  • If the group with highest score has multiple items, show them all. Otherwise, keep the same behavior.

WDYT?

LocalIPCommand for other OSes

Currently, to get local IP address, we use:

localIP <- PCommand("ipconfig", "getifaddr", "en0").string.bimap(CommandError.UnexpectedException, _.trim)

It works for macOS, but for Linux the command can vary based on the distro, not to mention Windows. For example, I'm using Manjaro and the default command to list addresses is ip a, which then needs some command line magic to extract the IP address.

We can use Java/Scala to get this information. This seems to work with my box (multiple interfaces, running together with docker and VMs)

val interfaces = NetworkInterface.getNetworkInterfaces.asScala.toList
interfaces.filter { interface =>
  !interface.isLoopback && !interface.isVirtual && interface.isUp
}.flatMap { interface =>
  interface.getInetAddresses.asScala.collect {
    case address: Inet4Address => interface.getDisplayName -> address.getHostAddress
  }
}

Windows Graal native image support

I gave this a try too, but ran into these blockers:
oracle/graal#1870
oracle/graal#1327

The next release looks like it'll include the fix. But even if you get passed that one, there might be other blockers lurking. Can't know until we try.

Also, Windows support for native-image seems very experimental right now. Just configuring everything was a huge pain for me. We might want to hold off on this issue until the Windows support is more stable. But if anybody wants to try tackling it anyway, that's fine with me.

Add better error handling

Right now I don't print errors because it interferes with the UI (at least for CLI mode). We need a logger that is aware of whether it's in CLI mode or not. If it's not, then print to the console. Otherwise print to a file I guess?

Another idea is to store errors in a ring buffer and have a Command for viewing these errors.

Add proper multi-monitor support

You should be able to specify which screen you want the pop-up terminal to show up on. This would go in the DisplayConfig class.

Improve UX when hitting enter quickly

Right now it's possible to type something really fast and hit enter and before the results have populated. This should be addressed in some way. A couple of things:

  • The debounce duration should be configurable (and setting it to 0 should disable it). Also, it's possible the default duration is too long.
  • When hitting enter, perhaps it should be queued up rather than running instantaneously.

The thing is, this is a delicate issue that's hard to get right. This will get trickier once #4 is addressed. We want to try to avoid issues where you type something, get some results, and then just as you hit enter a new result (one that you didn't want/expect) popped up and took its place for the highest score causing you to run a command you didn't intend to. For anyone who has tried using Spotlight, I'm sure you know exactly what I'm talking about. ๐Ÿ˜›

Spotify command

Playback controls for Spotify.

I imagine this will also need a cache ZIO Reader so that you can store whatever auth token/session ID (to prevent re-authing for each command).

Package/distribution file (.app/.exe/etc files)

I haven't done this before with a JVM app yet, but the daemon project should be packaged into a single executable like .app for macOS, .exe for Windows, and so on. The daemon project is a GUI application.

The cli-client on the other hand is fine to be a simple binary executable file. Ideally we distribute with homebrew for Mac and so on for other operating systems. Or just a plain install script.

Design better search execution model

The multiple events in Command are a bit awkward right now:

  • inputPreview
  • keywordPreview
  • prefixPreview
  • argsPreview

It also has the issue where if you implement multiple of these in a single command, things might be executed multiple times for a single input (assuming you don't early-exit).

I think maybe all of these could be combined into a single ADT and then have 1 def preview(...) which would replace the other 4. Or if not an ADT, one SearchInput class that you can parse into these different cases with helper methods.

Password manager integrations

Might want to separate this issue out for each password manager that we want to support, but basically I'd like to support the most common ones.

Calendar command

It would be nice to have a command for adding calendar events easily. I haven't thought about what the interface should look like, but something that is flexible might be best. I think I'd like to be able to write stuff like "John's welcome party @ 9pm" or something and it would add it to my configured calendar.

But if that's too difficult, a command line interface could work too. Something like:
cal --date tomorrow --time 19:00 Welcome Party

Or whatever else anybody else can think of.

Create KeyboardShortcut class

For a few reasons:

  • To not bring in a Swing dependency to core
  • For better parsing of keyboard shortcuts. For example, allowing to specify win/windows key instead of meta. And to allow more variations like ctrl vs. control and so on. And maybe even support symbols like โŒ˜ (for Mac).
  • Useful for #31. This would unify the keyboard shortcut format between Swing and lanterna.

Once that's done, change the configs like KeyboardConfig(openShortcut: String) to KeyboardConfig(openShortcut: KeyboardShortcut)

Add shortcut support for Commands

You should be able to set shortcuts for your commands (for example, cmd+G for Google, etc). If a single shortcut is bound to multiple commands, select the one with the highest score.

This is useful if you would rather not scroll through the results (or type more than you have to) for common operations.

Currency converter

This is self-explanatory. The only thing is which API do we use for this? Is there something that's free?

Menubar (system tray) support

This probably depends on the OS, but it would be nice to be able to not show the app's icon in the dock/taskbar since the daemon is basically always running. Apps like Alfred tend to show up only in the menubar (system tray for Windows).

Calculator command

You should be able to type math expressions like 52 + (21*672) and so on and it could show the result right there in the preview window. Support for n choose r, factorial, and all kinds of miscellaneous functions would be nice too. I find myself needing those a lot.

Graal native image support for daemon

Creating Graal native images are tricky depending on what features you're using. Creating one for daemon is probably not doable until some issues like Swing compatibility are resolved. For example: oracle/graal#664

A native-image for cli-client is more realistic and I got that mostly working. There are limitations though. For example, loading external plugins requires reflection and that doesn't gel well with native-image because of reflection limitations. I'm not sure if there's a way to make a plugin system work with native-image. This needs some investigation.

Timezone converter

Idea: 6pm ET = GMT will show 7pm. We can start with --time {time} --from {timezone} --to {timezone}.

  • If from is omitted, take current time zone, or a configured one. Same for to.
  • If time is omitted, take now().

Windows file search and open file/application support

I'm not too familiar with Windows and how good the default Windows search works (and whether you can use their internal API in the first place). But if it's not great, perhaps using the Everything tool for indexing would be a good option. It seems like it's a common choice among Windows application launchers.

Maps command

Opens Google Maps (or configurable alternatives). Should also support directions, something like from X to Y, directions X to Y, etc.

Add tests for core functionality

There are no tests right now and that makes it really easy to break things. "Add tests" is too broad of an issue, so for now the focus should probably be the Command.search functionality. The function doesn't require a broad set of dependencies, so it should be pretty easy to set up tests for. Just create a Vector of arbitrary commands and aliases and then pass in a search string and make sure the results are correct.

Clipboard manager

There's a lot that could be done here. But I was thinking about having a clipboard history, and possibly storing it as a tree-like structure could be cool. Might want to leverage existing solutions for this?

Also, there should probably be a way to clear the history. And perhaps something to prevent storing sensitive data in the history.

Escape/unescape encode/decode command

Each one should be its own Command object, but we can also add them to the general encode alias that maps to all of them.

Some that I had in mind:

  • URL encoder/decoder
  • Base 64 encoder/decoder
  • HTML encoder/decoder
  • Java/Scala/etc string escape/unescape
  • JSON escape/unescape
  • CSV escape/unescape
  • Unicode escape/unescape (U+0000 0x0000 formats)

And any other useful ones that you can think of.

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.