////
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at
  http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.
////
:description: Hop Search is a command line tool to search for metadata in Hop or a Hop project.

= Hop Search

Hop Search is a command line tool to search for metadata in Hop or a Hop project.

&nbsp; +

.Usage
[%collapsible]
=====

== Usage

[source,bash]
----
Usage: <main class> [-hilx] [-e=<environmentOption>] [-j=<projectOption>]
                    <searchString>
      <searchString>         The string to search for
  -e, --environment=<environmentOption>
                             The name of the lifecycle environment to use
  -h, --help                 Displays this help message and quits
  -i, --case-insensitive     Perform a case insensitive search
  -j, --project=<projectOption>
                             The name of the project to use
  -l, --print-locations      Print which locations are being looked at
  -v, --version              Print version information and exit 
  -x, --regular-expression   The specified search string is a regular expression
----

== Options

[options="header"]
|===
|Option|Description
|<searchString>|The string to search for
|-e|The name of the lifecycle environment to use
|-h|Displays this help message and quits
|-i|Perform a case insensitive search
|-j|The name of the project to use
|-l|Print which locations are being looked at
|-v|Print version information and exit 
|-x|The specified search string is a regular expression
|===

=====

&nbsp; +

== Examples

Example command: search for the string 'json' (case insensitive) in the 'hop-samples' project.

[tabs]
====
Windows::
+
--
[source,shell]
----
hop-search.bat -j samples -i switch-case
----

Expected output:

[source,shell]
----
C:\<YOUR_PATH>\hop>echo off
===[Environment Settings - hop-search.bat]===================================
Java identified as "C:\Program Files\Microsoft\jdk-11.0.17.8-hotspot\\bin\java"
HOP_OPTIONS=-Xmx2048m -DHOP_AUDIT_FOLDER=.\audit -DHOP_PLATFORM_OS=Windows -DHOP_PLATFORM_RUNTIME=Search
-DHOP_AUTO_CREATE_CONFIG=Y
Command to start Hop will be:
"C:\Program Files\Microsoft\jdk-11.0.17.8-hotspot\\bin\java" -classpath lib\core\*;lib\beam\*;lib\swt\win64\*
-Djava.library.path=lib\core;lib\beam -Xmx2048m -DHOP_AUDIT_FOLDER=.\audit -DHOP_PLATFORM_OS=Windows
-DHOP_PLATFORM_RUNTIME=Search -DHOP_AUTO_CREATE_CONFIG=Y org.apache.hop.config.HopConfig -j samples -i switch-case
===[Starting HopConfig]=========================================================
Enabling project 'samples'
Searching in project : samples
Searching for [switch-case]
Case sensitive? false
Regular expression? false
Searching in location : Project samples
-----------------------------------------------------------------------------------
file:///C:/<YOUR_PATH>/hop/config/projects/samples/beam/pipelines/switch-case.hpl : null(switch-case) : matching property value: switch-case
file:///C:/<YOUR_PATH>/hop/config/projects/samples/beam/pipelines/switch-case.hpl : switch-case(switch-case) : matching property value: switch-case
file:///C:/<YOUR_PATH>/hop/config/projects/samples/beam/pipelines/switch-case.hpl : switch-case(switch-case) : pipeline transform property : filePrefix
file:///C:/<YOUR_PATH>/hop/config/projects/samples/transforms/switch-case-basic.hpl : null(switch-case-basic) : matching property value: switch-case-basic
----

--

Linux, macOS::
+
--
[source, shell]
----
./hop-search.sh -j samples -i switch-case
----

Expected output:

[source,shell]
----
Enabling project 'samples'
Searching in project : samples
Searching for [switch-case]
Case sensitive? false
Regular expression? false
Searching in location : Project samples
-----------------------------------------------------------------------------------
file://<YOUR_PATH>/hop/config/projects/samples/transforms/switch-case-basic.hpl : null(switch-case-basic) : matching property value: switch-case-basic
file://<YOUR_PATH>/hop/config/projects/samples/beam/pipelines/switch-case.hpl : null(switch-case) : matching property value: switch-case
file://<YOUR_PATH>/hop/config/projects/samples/beam/pipelines/switch-case.hpl : switch-case(switch-case) : matching property value: switch-case
file://<YOUR_PATH>/hop/config/projects/samples/beam/pipelines/switch-case.hpl : switch-case(switch-case) : pipeline transform property : filePrefix
----
--
====
