From ef59864ffe22b678036e488b6851851f0484496b Mon Sep 17 00:00:00 2001 From: DBAKITA <87822858+DBAKITA@users.noreply.github.com> Date: Fri, 4 Nov 2022 17:35:29 +0300 Subject: [PATCH 1/3] Update command-line-tool.md Added description about how command line tools work and different user cases for arguments and input --- src/topics/command-line-tool.md | 66 +++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/src/topics/command-line-tool.md b/src/topics/command-line-tool.md index 1aea6311..a457fae6 100644 --- a/src/topics/command-line-tool.md +++ b/src/topics/command-line-tool.md @@ -10,6 +10,9 @@ The following example contains a minimal example of a CWL command-line tool for the `echo` Linux command, using inputs and outputs. +How Command-lines work +A Command Line Tool is a non-interactive executable program that reads some input, performs a computation, and terminates after producing some output. Command line programs are a flexible unit of code sharing and reuse, unfortunately the syntax and input/output semantics among command line programs is extremely heterogeneous. A common layer for describing the syntax and semantics of programs can reduce this incidental complexity by providing a consistent way to connect programs together. This specification defines the Common Workflow Language (CWL) Command Line Tool Description, a vendor-neutral standard for describing the syntax and input/output semantics of command line programs. + % TODO: Fix the missing link the graph below. We cannot have % it here as this file is included in two other files. % Sphinx prohibits it for the case where this could lead @@ -63,7 +66,70 @@ and in the [Outputs](../topics/outputs.md) sections. % % - Spaces in commands https://github.com/common-workflow-language/user_guide/issues/39 % - Arguments (tell the reader the different use cases for arguments and inputs, tell them there is a section about inputs) +Different use cases for arguments and inputs +Available primitive types are string, int, long, float, double, and null; complex types are array and record; in addition there are special types File, Directory and Any. + +The following example demonstrates some input parameters with different types and appearing on the command line in different ways. + +First, create a file called inp.cwl, containing the following: +inp.cwl +#!/usr/bin/env cwl-runner + +cwlVersion: v1.0 +class: CommandLineTool +baseCommand: echo +inputs: + example_flag: + type: boolean + inputBinding: + position: 1 + prefix: -f + example_string: + type: string + inputBinding: + position: 3 + prefix: --example-string + example_int: + type: int + inputBinding: + position: 2 + prefix: -i + separate: false + example_file: + type: File? + inputBinding: + prefix: --file= + separate: false + position: 4 + +outputs: [] + +Sometimes tools require additional command line options that don’t correspond exactly to input parameters. + +In this example, we will wrap the Java compiler to compile a java source file to a class file. By default, “javac” will create the class files in the same directory as the source file. However, CWL input files (and the directories in which they appear) may be read-only, so we need to instruct “javac” to write the class file to the designated output directory instead. + +arguments.cwl +#!/usr/bin/env cwl-runner + +cwlVersion: v1.0 +class: CommandLineTool +label: Example trivial wrapper for Java 9 compiler +hints: + DockerRequirement: + dockerPull: openjdk:9.0.1-11-slim +baseCommand: javac +arguments: ["-d", $(runtime.outdir)] +inputs: + src: + type: File + inputBinding: + position: 1 +outputs: + classfile: + type: File + outputBinding: + glob: "*.class" ## Network Access This indicates whether a process requires outgoing IPv4/IPv6 network access. From 899aff10a6d545c544da812f0bf3cb1b8534de24 Mon Sep 17 00:00:00 2001 From: DBAKITA <87822858+DBAKITA@users.noreply.github.com> Date: Fri, 11 Nov 2022 23:44:32 +0300 Subject: [PATCH 2/3] Update command-line-tool.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On Line 13, i changed the Heading "How command lines work" from small letters to upper case On Line 14, I removed the old description "A Command Line Tool is a non-interactive executable program that reads some input, performs a computation, and terminates after producing some output. Command line programs are a flexible unit of code sharing and reuse, unfortunately the syntax and input/output semantics among command line programs is extremely heterogeneous. A common layer for describing the syntax and semantics of programs can reduce this incidental complexity by providing a consistent way to connect programs together. This specification defines the Common Workflow Language (CWL) Command Line Tool Description, a vendor-neutral standard for describing the syntax and input/output semantics of command line programs" to a new text "The command line is a text interface for your computer. It’s a program that takes in commands, which it passes on to the computer’s operating system to run. From the command line, you can navigate through files and folders on your computer, just as you would with Windows Explorer on Windows or Finder on Mac OS. The difference is that the command line is fully text-based. Abbreviated as CLI, a Command Line Interface connects a user to a computer program or operating system. Through the CLI, users interact with a system or application by typing in text (commands). The command is typed on a specific line following a visual prompt from the computer. The system responds to the text, and the user may then type on the next command line that appears. Through this command and response interaction, the user is able to issue a series of commands, which are executed by the system or program. Systems and software can provide users with both CLI and Graphical User Interface (GUI) options" --- src/topics/command-line-tool.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/topics/command-line-tool.md b/src/topics/command-line-tool.md index a457fae6..ead0bdf3 100644 --- a/src/topics/command-line-tool.md +++ b/src/topics/command-line-tool.md @@ -10,8 +10,12 @@ The following example contains a minimal example of a CWL command-line tool for the `echo` Linux command, using inputs and outputs. -How Command-lines work -A Command Line Tool is a non-interactive executable program that reads some input, performs a computation, and terminates after producing some output. Command line programs are a flexible unit of code sharing and reuse, unfortunately the syntax and input/output semantics among command line programs is extremely heterogeneous. A common layer for describing the syntax and semantics of programs can reduce this incidental complexity by providing a consistent way to connect programs together. This specification defines the Common Workflow Language (CWL) Command Line Tool Description, a vendor-neutral standard for describing the syntax and input/output semantics of command line programs. +HOW COMMAND LINES WORK +The command line is a text interface for your computer. It’s a program that takes in commands, which it passes on to the computer’s operating system to run. From the command line, you can navigate through files and folders on your computer, just as you would with Windows Explorer on Windows or Finder on Mac OS. The difference is that the command line is fully text-based. Abbreviated as CLI, a Command Line Interface connects a user to a computer program or operating system. Through the CLI, users interact with a system or application by typing in text (commands). The command is typed on a specific line following a visual prompt from the computer. Abbreviated as CLI, a Command Line Interface connects a user to a computer program or operating system. Through the CLI, users interact with a system or application by typing in text (commands). The command is typed on a specific line following a visual prompt from the computer. + + + + % TODO: Fix the missing link the graph below. We cannot have % it here as this file is included in two other files. From 1020f8dc7957c1fc467c2d722407c15290917cae Mon Sep 17 00:00:00 2001 From: DBAKITA <87822858+DBAKITA@users.noreply.github.com> Date: Sat, 12 Nov 2022 00:42:46 +0300 Subject: [PATCH 3/3] Update command-line-tool.md On line 69, I changed the text "Different use case for arguments and inputs" from lower case to upper case. On line 70-71, I explain the differences between arguments and input On line 72, I tell the reader that they will learn more about inputs in section 2.4 On line 74-76 I gave use cases for command line arguments --- src/topics/command-line-tool.md | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/topics/command-line-tool.md b/src/topics/command-line-tool.md index ead0bdf3..40023498 100644 --- a/src/topics/command-line-tool.md +++ b/src/topics/command-line-tool.md @@ -58,19 +58,23 @@ digraph G { :language: cwl :caption: "`echo.cwl`" ``` - ```{note} - -The example above uses a simplified form to define inputs and outputs. -You will learn more about in the [Inputs](../topics/inputs.md) +The example above uses a simplified form to define inputs and outputs.You will learn more about in the [Inputs](../topics/inputs.md) and in the [Outputs](../topics/outputs.md) sections. ``` - % TODO % % - Spaces in commands https://github.com/common-workflow-language/user_guide/issues/39 % - Arguments (tell the reader the different use cases for arguments and inputs, tell them there is a section about inputs) -Different use cases for arguments and inputs +DIFFERENCES BEWTWEEN ARGUMENTS AND INPUTS +Command line arguments are given to an application before it is run. For example First we give the app JavaProgram the command line arguments 30, 91, only then do we hit Enter and run it as a Java program. On the other hand, input can be given to an application during its run, because it can only ask for input after it started running. For that reason, we can print some text to the user before asking for input, indicating what input we are expecting for, etc. +The second difference is that Input can be taken any number of times. For that reason, input can be interactive - the system can take input, then respond according to it, then take more input, etc. Command line arguments are taken once, therefore can not be used to manage any interactiveness. +You will learn more about inputs in section 2.4 +USE CASES FOR THE COMMAND LINE ARGUMENTS +Command line arguments are extra commands you can use when launching a program so that the program's functionality will change. Depending on the program, these arguments can be used to add more features that includes specifying a file that output should be logged to, specifying a default document to launch, or to enable features that may be a bit buggy for normal use. +A command line argument is simply anything we enter after the executable name. for example, if we launched Notepad using the command C:\Windows\System32\notepad.exe /s, then /s would be the command line argument we used. +It is important to note that you must add a space betten the program you want to run and the command line argument. For example notepad.exe/s is not a valid argument because it does not contain aspace. Instead you must add a space so it looks like notpad.exe /s. + Available primitive types are string, int, long, float, double, and null; complex types are array and record; in addition there are special types File, Directory and Any. The following example demonstrates some input parameters with different types and appearing on the command line in different ways.