Skip to content
This repository has been archived by the owner on Jan 3, 2023. It is now read-only.

Commit

Permalink
Close #157 - Add new wildcard 'R'
Browse files Browse the repository at this point in the history
  • Loading branch information
jibedoubleve committed Aug 9, 2021
1 parent 522af34 commit 2a34f93
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 10 deletions.
17 changes: 8 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
- [Create shortcuts (UI)](#create-shortcuts-ui)
- [Predifined keywords](#predifined-keywords)
- [Replacement macros](#replacement-macros)
- [Plugins](/doc/pages/plugins.md)
- [Data Reconciliation](/doc/pages/data_reconciliation.md)
- [Print screens](#print-screens)
- [Acknowledgement](#acknowledgement)

Expand Down Expand Up @@ -44,8 +42,8 @@ When you've used the shortcut, a window appears.
For instance, I've configured a google search as follow `? my_search`. In other words, if I want to search 'aeroplane' in google, I write `? aeroplane`.

Here's how the command is configured
| keyword | file name |
| ------- | ----------------------------------------- |
| keyword | file name |
| ------- | ------------------------------------------- |
| ? | https://www.google.com/search?hl=en&q=\$W\$ |

> the use of \$W$\ is defined [HERE](#replacement-macros)
Expand Down Expand Up @@ -117,11 +115,12 @@ Some keyword are reserved and have some specific behaviour:

Any occurence of these macro in the `File Name` text box will be replace as follow.

| macro | explanation |
| ----- | -------------------------------------------------------------------------------- |
| \$C\$ | is replaced with contents of the Clipboard. |
| \$I\$ | will replace the \$I\$ with typed parameters |
| \$W\$ | will replace the \$I\$ with typed parameters in the format most web URLs expect |
| macro | explanation |
| ----- | --------------------------------------------------------------------- |
| \$C\$ | will replace with the Clipboard in the format most web URLs expect |
| \$R\$ | will replace with the Clipboard |
| \$I\$ | will replace with typed parameters |
| \$W\$ | will replace with typed parameters in the format most web URLs expect |


# Print screens
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ServicesImpl\AliasService.cs" />
<Compile Include="ServicesImpl\ArgumentHandlers\ClipboardHandler.cs" />
<Compile Include="ServicesImpl\ArgumentHandlers\ClipboardRawHandler.cs" />
<Compile Include="ServicesImpl\ArgumentHandlers\TextHandler.cs" />
<Compile Include="ServicesImpl\ArgumentHandlers\UriHandler.cs" />
<Compile Include="ServicesImpl\ArgumentHandlers\_ArgumentHandler.cs" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using Probel.Lanceur.Core.Services;

namespace Probel.Lanceur.Infrastructure.ServicesImpl.ArgumentHandlers
{
public class ClipboardRawHandler : ArgumentHandler
{
#region Fields

private readonly IClipboardService _clipboard;

#endregion Fields

#region Constructors

public ClipboardRawHandler(IClipboardService clipboard) : base(Wildcards.RawClipboard) => _clipboard = clipboard;

#endregion Constructors

#region Methods

protected override string DoHandle(string cmdline, string parameters)
{
var resolved = cmdline.ToLower().Replace(Wildcard, _clipboard.GetText());
return resolved;
}

#endregion Methods
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ public ParameterResolver(IClipboardService clipboardService, IDataSourceService
_dataService = dataService;
_handler = new TextHandler()
.SetNext(new UriHandler())
.SetNext(new ClipboardHandler(clipboardService));
.SetNext(new ClipboardHandler(clipboardService))
.SetNext(new ClipboardRawHandler(clipboardService));
}

#endregion Constructors
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ public static class Wildcards
#region Fields

public const string Clipboard = "$c$";
public const string RawClipboard = "$r$";
public const string Text = "$i$";
public const string Url = "$w$";

Expand Down

0 comments on commit 2a34f93

Please sign in to comment.