Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/tymbaca/pagemerger
Browse files Browse the repository at this point in the history
  • Loading branch information
tymbaca committed Jun 29, 2023
2 parents 9e04c02 + 3697020 commit 38630bb
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 11 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
bin
obj
*.docx

# locale
.vscode
7 changes: 6 additions & 1 deletion Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,18 @@ public class Options

static public void Main(string[] args)
{
Parser.Default.ParseArguments<Options>(args).WithParsed<Options>(o => {
var parseResult = Parser.Default.ParseArguments<Options>(args).WithParsed<Options>(o => {
// Console.Write(String.Join(", ", o.filenames));
File.Delete(o.OutputFilename);
var merger = new FileMerger(o.OutputFilename, o.Filenames, o.SetPageBreaks);
// merger.MergeFiles();
merger.MergeFiles();
});
if (parseResult.Errors.Count() == 0) {
Environment.Exit(0);
} else {
Environment.Exit(1);
}
}
}

Expand Down
36 changes: 26 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,45 @@
## Install
For now it's not in any package manager repository. Only option is to build it from source.

Clone repository to your local machine:
```sh
git clone https://github.com/tymbaca/pagemerger.git
```

## Build

### tl;dr
```sh
git clone https://github.com/tymbaca/pagemerger.git
cd pagemerger
dotnet add package DocumentFormat.OpenXml --version 2.20.0
dotnet add package CommandLineParser --version 2.9.1
dotnet publish -o ./result -p:PublishSingleFile=true --self-contained false
cd result
sudo mv pagemerger /usr/local/bin
```

> For build make sure you have those dependancies:
> - [.NET](https://dotnet.microsoft.com/en-us/download) (7 and later)
> - .NET packages:
> - [CommandLineParser](https://github.com/commandlineparser/commandline) (2.9.1 and later)
> - [Open-XML-SDK](https://github.com/dotnet/Open-XML-SDK) (2.20.0 and later)
To build project to single executable file simply run this command from project directory:
```sh
dotnet publish -p:PublishSingleFile=true --self-contained false
```

It will build and also *print the folder* where executable is placed:
To build project to single executable file go to project directory and run this command:

```sh
pagemerger -> /.../pagemerger/bin/Debug/net7.0/osx-x64/pagemerger.dll
pagemerger -> /.../pagemerger/bin/Debug/net7.0/osx-x64/publish/
dotnet publish -o ./result -p:PublishSingleFile=true --self-contained false
```

Or use `-o` option with following path to specify the output directory:
> Notice that `-o` option specifies output directory where built binary will be putted. You can choose another directory if you wish.
Then go to output directory and move binary to one of the directories that are in PATH (usually you can put it into `/usr/local/bin`):
```sh
dotnet publish -o example/directory -p:PublishSingleFile=true --self-contained false
cd result
sudo mv pagemerger /usr/local/bin
```


## Usage

Run program with arguments in following order:
Expand Down

0 comments on commit 38630bb

Please sign in to comment.