You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The purpose of this project is to present a unique framework that makes use of Blockly, a visual programming language, to represent Unix commands as graphical blocks and to convey their abstractions. Through simplifying the way of their operation and the elimination of the requirement for specialist programming expertise, this method intends to make Unix utilities more accessible to a wider audience.The thesis provides an explanation of the development of a visual programming interface that simplifies the utilization of Unix command-line tools by allowing users to design data processing pipelines by dragging and dropping components. Visual blocks are connected to Unix instructions through the use of JSON specification files, which are utilized by the system in order to facilitate the conversion process.
10
10
11
11
The user-friendliness of data processing activities is improved as a result of this deliberate design choice, and users are encouraged to develop a deeper understanding of Unix commands. Increasing the accessibility of complex data manipulation is one of the goals of this initiative, which also aims to encourage more people to participate in computational data analysis.The findings of the project underline the significance of visual programming in the process of combining complex command-line activities with user-friendly interfaces. This, in turn, broadens the range of tools that are available to data scientists and researchers working in a variety of fields. This research not only makes a contribution to the field of visual programming, but it also opens up new possibilities for instructional tools that facilitate the acquisition of command-line interfaces using approaches that are both interactive and interesting.
12
12
13
-
# Installation Instructions
13
+
# Set up instructions
14
14
15
-
1. Follow the instructions on how to download and install **Blockly** locally on your PC on the official **Blockly** repository : https://github.com/google/blockly
16
-
2. Clone this project into the **_demos_** directory of **Blockly** you installed
15
+
To run UBlocks on a local server, navigate to the top-level directory and start the development server by running the following command:
To ensure that code is properly formatted before committing, set up the pre-commit hook by following these steps :
31
22
@@ -37,6 +28,135 @@ To ensure that code is properly formatted before committing, set up the pre-comm
37
28
38
29
`chmod +x .git/hooks/pre-commit bin/pre-commit`
39
30
31
+
# How to Create a New Block
32
+
33
+
Below are the instructions on how to create a new block in a separate file (e.g., `[blockName]Block.js`), and how to integrate it into the existing code generation system (`UnixGenerator`) that we have already implemented.
34
+
35
+
## 1. Create a New File for Your Block
36
+
37
+
Inside the folder where you keep your blocks (`blocks/`), create a new file named `[blockName]Block.js`.
38
+
For instance, if you want to create a block for a command called `foo`, you can name it `fooBlock.js`.
39
+
40
+
## 2. Define the Block Using a JSON Schema
41
+
42
+
In this new file, define your block using the JSON schema required by Blockly. Below is a basic structure:
43
+
44
+
```js
45
+
var fooBlock = {
46
+
type:'foo', // Unique name for the block
47
+
category:'My Custom Category', // Category in which the block will appear in the toolbox
48
+
unix_description: [
49
+
// The "unix_description" array defines how totranslate the block into a Unix command.
50
+
{
51
+
foo:'customFoo',
52
+
printName:true, // "printName" specifies whether the block's type should appear explicitly in the generated command.
In the **UnixGenerator** architecture, each **Blockly** block has an associated `unix_description`, which describes how its fields (`fieldValues`) and child blocks (`childCode`) should be translated into a Unix command. Also it is crucial that the keys used in unix_description correspond exactly to the names of the fields defined in args. This ensures that the generator can correctly map field values to their respective parts in the Unix command. Below is a high-level overview of how this works:
95
+
96
+
#### 2.1.1 **`unix_description` Structure**
97
+
98
+
- Typically, `unix_description` is an array of one or more objects. Each object specifies functions and/or flags that define how to compose the final command.
99
+
- Example:
100
+
```js
101
+
unix_description: [
102
+
{
103
+
printName:true, // Determines if the block's type should be printed in the command
104
+
someFieldName:'-f', // Static string to be added if the field is active
105
+
// Function to dynamically process fieldValues and childCode
-**`generic`**: This handler typically adds a pipe symbol (`|`) between commands, following the standard Unix “piping” convention.
140
+
-**`concat`**: This handler concatenates the output without a pipe or spaces, or uses a different connector if defined. It’s useful for scenarios where multiple arguments are strung together (e.g., building up a filename or a single argument line).
141
+
142
+
#### 2.1.4 Customizing Output with Block Names
143
+
144
+
**Specifying the Block's Name in `unix_description`:**
145
+
You can override the default block name in the generated command by specifying a different key in `unix_description`. For example:
146
+
147
+
```js
148
+
unix_description: [
149
+
{
150
+
foo:'customFoo', // Instead of printing 'foo', it will print 'customFoo' in the command
151
+
printName:true
152
+
}
153
+
];
154
+
```
155
+
156
+
In this case, if the block's type is 'foo' and you set 'foo': 'customFoo' in unix_description, the generated command will include 'customFoo' instead of 'foo'. 3. Format the code by running the following command:
157
+
158
+
`npm run prettier-fix`
159
+
40
160
# Further information
41
161
42
162
The work behind this project is further documented in MSc theses by
0 commit comments