Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
ololx committed Aug 2, 2021
2 parents 60cec5f + 0386878 commit 1c02a24
Show file tree
Hide file tree
Showing 10 changed files with 129 additions and 24 deletions.
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,26 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p

## [Unreleased] - yyyy-mm-dd

### Changed

- Refactor application.

## [0.5.0] - 2021-08-02

### Added

- Add the new menu item for replacing selected folders and files with symlinks.
- Add the new menu item for creating symlink in a parent directory (parent for target objects).

## [0.4.1] - 2021-07-15

### Changed

- Implement the `Command` pattern for the `Quick Symlink` actions.

### Added

- Add the new menu item for replacing selected folders and files with symlinks.

## [0.4.0] - 2021-07-15

### Added
Expand Down
71 changes: 49 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

The Quick Symlink is a `Finder extension` which provides a `contextual menu item` for the symbolic links creation on macOS.

[![status](https://img.shields.io/badge/status-active-active?style=flat-square)](BADGES_GUIDE.md#status) [![version](https://img.shields.io/badge/version-0.4.1-informational?style=flat-square)](BADGES_GUIDE.md#version) [![oss lifecycle](https://img.shields.io/badge/oss_lifecycle-active-important?style=flat-square)](BADGES_GUIDE.md#oss-lifecycle) [![maintenance](https://img.shields.io/badge/maintenance-yes-informational?style=flat-square)](BADGES_GUIDE.md#maintenance) [![last release](https://img.shields.io/badge/last_release-July_16,_2021-informational?style=flat-square)](BADGES_GUIDE.md#release-date) [![last commit](https://img.shields.io/badge/last_commit-July_16,_2021-informational?style=flat-square)](BADGES_GUIDE.md#commit-date)
[![status](https://img.shields.io/badge/status-active-active?style=flat-square)](BADGES_GUIDE.md#status) [![version](https://img.shields.io/badge/version-0.5.0-informational?style=flat-square)](BADGES_GUIDE.md#version) [![oss lifecycle](https://img.shields.io/badge/oss_lifecycle-active-important?style=flat-square)](BADGES_GUIDE.md#oss-lifecycle) [![maintenance](https://img.shields.io/badge/maintenance-yes-informational?style=flat-square)](BADGES_GUIDE.md#maintenance) [![last release](https://img.shields.io/badge/last_release-August_02,_2021-informational?style=flat-square)](BADGES_GUIDE.md#release-date) [![last commit](https://img.shields.io/badge/last_commit-August_02,_2021-informational?style=flat-square)](BADGES_GUIDE.md#commit-date)

[![license](https://img.shields.io/badge/license-MIT-informational?style=flat-square)](LICENSE) [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg?style=flat-square)](CODE_OF_CONDUCT.md)

Expand All @@ -12,16 +12,16 @@ The Quick Symlink is a `Finder extension` which provides a `contextual menu ite

## 📇 Table of Contents

- [About](#about)
- [Demo](#demo)
- [Features](#feature)
- [Getting Started](#getting-started)
- [Built With](#built-with)
- [Contributing](#contributing)
- [Code of Conduct](#code-of-conduct)
- [Versioning](#versioning)
- [Authors](#authors)
- [Licensing](#licensing)
- [About](#-about-)
- [Demo](#-demo-)
- [Features](#-feature-)
- [Getting Started](#-getting-started-)
- [Built With](#-built-with-)
- [Contributing](#-contributing-)
- [Code of Conduct](#-code-of-conduct-)
- [Versioning](#-versioning-)
- [Authors](#-authors-)
- [Licensing](#-licensing-)

## 📖 About

Expand All @@ -34,6 +34,10 @@ Of course, creating symbolic links via the terminal is very easy and convenient.

## 📸 Demo

This GIF demonstrates how the `Quick Symlink` allows quite simple to select files or folders and paste symlink in the current directory.

<img src="https://github.com/ololx/quick-symlink/blob/assets/demo/quick-symlink-demo-2.gif?raw=true" width="100%"/>

This GIF demonstrates how the `Quick Symlink` allows quite simple to copy files or folders and paste symlink somewhere.

<img src="https://github.com/ololx/quick-symlink/blob/assets/demo/quick-symlink-demo-1.gif?raw=true" width="100%"/>
Expand All @@ -42,23 +46,26 @@ This GIF demonstrates how the `Quick Symlink` allows quite simple to copy files

<img src="https://github.com/ololx/quick-symlink/blob/assets/demo/quick-symlink-demo-replace-with-link.gif?raw=true" width="100%"/>

These GIFs demonstrate the `Quick Symlink` localization (English and Russian).

<img src="https://github.com/ololx/quick-symlink/blob/assets/demo/quick-symlink-demo-localization-1.gif?raw=true" width="100%"/>
<img src="https://github.com/ololx/quick-symlink/blob/assets/demo/quick-symlink-demo-localization-2.gif?raw=true" width="100%"/>
<details close>
<summary>These GIFs demonstrate the `Quick Symlink` localization.</summary>
<img src="https://github.com/ololx/quick-symlink/blob/assets/demo/quick-symlink-demo-localization-1.gif?raw=true" width="100%"/>
<img src="https://github.com/ololx/quick-symlink/blob/assets/demo/quick-symlink-demo-localization-2.gif?raw=true" width="100%"/>
</details>

## 🎚 Features

- Create a symbolic links in a several clicks via the context menu instead of the terminal promt.
- Create a symbolic links for the selected files or folders.
- Create a symbolic links in a several clicks via the context menu instead of the terminal promt:
- Select files or folders and create symlink for them.
- Copy files or folders and paste symlink somewhere.
- Copy files or folders, paste them somewhere, and replace them with symlinks.

### To Do

- For more information on an upcoming development, please read the [todo](TODO.md) list.

### Changelog

- For more information on a releases, a features and a changes, please read the [changelog](CHANGELOG.md) notes.
- For more information on releases, features and changes, please read the [changelog](CHANGELOG.md) notes.

## 🚦 Getting Started

Expand All @@ -73,7 +80,7 @@ Before using it, make sure that follows software are installed on the local mach
If any of the listed programs is not installed, then it can be installed by instruction as described below.

1. #### OS X 10.11+
- Install macOS 10.14+ by [this](https://support.apple.com/ht201372) instruction.
- Install macOS 10.11+ by [this](https://support.apple.com/ht201372) instruction.

### Installing

Expand Down Expand Up @@ -132,14 +139,34 @@ https://github.com/ololx/quick-symlink.git

### Using

For use it is required to:
This tool allows to:
* Create symlinks in the current directory
* Create symlinks in another directory
* Replace objects with symbolic links

#### Creating symlinks in the current directory

1. Select folders or files for which a symbolic link is needed.
2. Call the contextual menu by the right-clicking on selected.
3. Select menu item `Quick Symlink --> Create symlink for`.

#### Creating symlinks in another directory

1. Select folders or files for which a symbolic link is needed.
2. Call the contextual menu by the right-clicking on selected.
3. Select menu item `Quick Symlink --> Copy path from here`.
4. Go to a destination folder.
5. Call the contextual menu by right-clicking on the filder.
6. Select menu item `Quick Symlink --> Paste to here`.

#### Replacing objects with symbolic links

1. Select folders or files for which a symbolic link is needed.
2. Call the contextual menu by right-clicking on selected.
2. Call the contextual menu by the right-clicking on selected.
3. Select menu item `Quick Symlink --> Copy to clipboard`.
4. Go to a destination folder.
5. Call the contextual menu by right-clicking on the filder.
6. Select menu item `Quick Symlink --> Paste from clipboard`.
6. Select menu item `Quick Symlink --> Move it here and replace with a link`.

## 🛠 Built With

Expand Down
1 change: 1 addition & 0 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- [x] Develop the `Finder extension` which allows to create a symlinks for selected folders and files via contextual menu.
- [x] Add the new menu item for replacing selected folders and files with symlinks.
- [x] Add the new menu item for creating symlink in a parent directory (parent for target objects).
- [ ] Add localization for other languages.
- [ ] Implement the VIPER pattern.
- [ ] Refactor app.
Expand Down
39 changes: 39 additions & 0 deletions commons/CreateLinkAction.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
//
// CreateLinkAction.swift
// quick-symlink
//
// Created by Alexander A. Kropotin on 02/08/2021.
// Copyright © 2021 Alexander A. Kropotin. All rights reserved.
//

import Foundation
import FinderSync

public class CreateLinkAction: QuickSymlinkAction {

private var finderController: FIFinderSyncController;

public init() {
self.finderController = FIFinderSyncController.default();
}

public func execute() {
//Get all selected path
guard let target = self.finderController.selectedItemURLs() else {
NSLog("FinderSync() failed to obtain targeted URLs: %@");

return;
}

for path in target {
let targetPath = self.getTargetPath(path, to: path.deletingLastPathComponent());

do {
try FileManager.default.createSymbolicLink(at: targetPath!, withDestinationURL: path);
} catch let error as NSError {
NSLog("FileManager.createSymbolicLink() failed to create file: %@", error.description as NSString);
}
}
}
}

3 changes: 3 additions & 0 deletions quick-symlink-extension/Base.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@

/* Class = "NSMenuItem"; */
"REPLACE_WITH_LINK_ACTION_NAME" = "Move it here and replace with a link";

/* Class = "NSMenuItem"; */
"CREATE_LINK_ACTION_NAME" = "Create link for";
10 changes: 10 additions & 0 deletions quick-symlink-extension/FinderSync.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class FinderSync: FIFinderSync {
let copyPathAction = CopyPathAction.init();
let pasteLinkAction = PasteLinkAction.init();
let replaceWithLinkAction = ReplaceWithLinkAction.init();
let createSymlink = CreateLinkAction.init();

override init() {
super.init()
Expand Down Expand Up @@ -74,6 +75,11 @@ class FinderSync: FIFinderSync {
override func menu(for menuKind: FIMenuKind) -> NSMenu {
// Produce a menu for the extension (to be shown when right clicking a folder in Finder)
let quickSymlinkMenu = NSMenu(title: "");
quickSymlinkMenu.addItem(
withTitle: NSLocalizedString("CREATE_LINK_ACTION_NAME", comment: ""),
action: #selector(createSymlink(_:)),
keyEquivalent: ""
);
quickSymlinkMenu.addItem(
withTitle: NSLocalizedString("COPY_PATH_ACTION_NAME", comment: ""),
action: #selector(copyPathToClipboard(_:)),
Expand Down Expand Up @@ -117,4 +123,8 @@ class FinderSync: FIFinderSync {
@IBAction func pastleSymlinkFromClipboard(_ sender: AnyObject?) {
self.pasteLinkAction.execute();
}

@IBAction func createSymlink(_ sender: AnyObject?) {
self.createSymlink.execute();
}
}
3 changes: 3 additions & 0 deletions quick-symlink-extension/en-GB.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@

/* Class = "NSMenuItem"; */
"REPLACE_WITH_LINK_ACTION_NAME" = "Move it here and replace with a link";

/* Class = "NSMenuItem"; */
"CREATE_LINK_ACTION_NAME" = "Create link for";
3 changes: 3 additions & 0 deletions quick-symlink-extension/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@

/* Class = "NSMenuItem"; */
"REPLACE_WITH_LINK_ACTION_NAME" = "Move it here and replace with a link";

/* Class = "NSMenuItem"; */
"CREATE_LINK_ACTION_NAME" = "Create link for";
5 changes: 4 additions & 1 deletion quick-symlink-extension/ru.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

/* Class = "NSMenuItem"; */
"EXTENTION_NAME" = "Быстрая символьная ссылка";
"EXTENTION_NAME" = "Быстрый симлинк";

/* Class = "NSMenuItem"; */
"EXTENTION_TOOL_TIP" = "Создать символьные ссылки для выбранных файлов и папок";
Expand All @@ -20,3 +20,6 @@

/* Class = "NSMenuItem"; */
"REPLACE_WITH_LINK_ACTION_NAME" = "Переместить сюда и заменить ссылкой";

/* Class = "NSMenuItem"; */
"CREATE_LINK_ACTION_NAME" = "Создать ссылку";
6 changes: 6 additions & 0 deletions quick-symlink.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
A30D4A4B26A0C14400BA775B /* PasteLinkAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = A345C9C426A0B49C004FBF0F /* PasteLinkAction.swift */; };
A30D4A4C26A0C14400BA775B /* ReplaceWithLinkAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = A345C9C726A0B552004FBF0F /* ReplaceWithLinkAction.swift */; };
A30D4A4D26A0C18B00BA775B /* QuickSymlinkAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = A345C9BE26A0B200004FBF0F /* QuickSymlinkAction.swift */; };
A316477726B7B403001DD969 /* CreateLinkAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = A316477626B7B403001DD969 /* CreateLinkAction.swift */; };
A316477826B7B403001DD969 /* CreateLinkAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = A316477626B7B403001DD969 /* CreateLinkAction.swift */; };
A32EE8E0265D4D05008648AA /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A32EE8DF265D4D05008648AA /* Assets.xcassets */; };
A345C9BF26A0B200004FBF0F /* QuickSymlinkAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = A345C9BE26A0B200004FBF0F /* QuickSymlinkAction.swift */; };
A345C9C226A0B30F004FBF0F /* CopyPathAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = A345C9C126A0B30F004FBF0F /* CopyPathAction.swift */; };
Expand Down Expand Up @@ -62,6 +64,7 @@
A30B9AC2265CA68900ACAA63 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
A30B9AC3265CA68900ACAA63 /* quick_symlink_extension.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = quick_symlink_extension.entitlements; sourceTree = "<group>"; };
A30B9ACB265CA78600ACAA63 /* quick-symlink-extension.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "quick-symlink-extension.entitlements"; sourceTree = "<group>"; };
A316477626B7B403001DD969 /* CreateLinkAction.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CreateLinkAction.swift; sourceTree = "<group>"; };
A32EE8DF265D4D05008648AA /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
A345C9BE26A0B200004FBF0F /* QuickSymlinkAction.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QuickSymlinkAction.swift; sourceTree = "<group>"; };
A345C9C126A0B30F004FBF0F /* CopyPathAction.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CopyPathAction.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -146,6 +149,7 @@
A345C9C126A0B30F004FBF0F /* CopyPathAction.swift */,
A345C9C426A0B49C004FBF0F /* PasteLinkAction.swift */,
A345C9C726A0B552004FBF0F /* ReplaceWithLinkAction.swift */,
A316477626B7B403001DD969 /* CreateLinkAction.swift */,
);
path = commons;
sourceTree = "<group>";
Expand Down Expand Up @@ -262,6 +266,7 @@
buildActionMask = 2147483647;
files = (
A345C9C826A0B552004FBF0F /* ReplaceWithLinkAction.swift in Sources */,
A316477726B7B403001DD969 /* CreateLinkAction.swift in Sources */,
A30B9AAD265CA63300ACAA63 /* ViewController.swift in Sources */,
A345C9C226A0B30F004FBF0F /* CopyPathAction.swift in Sources */,
A345C9BF26A0B200004FBF0F /* QuickSymlinkAction.swift in Sources */,
Expand All @@ -277,6 +282,7 @@
A30B9AC1265CA68900ACAA63 /* FinderSync.swift in Sources */,
A30D4A4B26A0C14400BA775B /* PasteLinkAction.swift in Sources */,
A30D4A4C26A0C14400BA775B /* ReplaceWithLinkAction.swift in Sources */,
A316477826B7B403001DD969 /* CreateLinkAction.swift in Sources */,
A30D4A4D26A0C18B00BA775B /* QuickSymlinkAction.swift in Sources */,
A30D4A4A26A0C14400BA775B /* CopyPathAction.swift in Sources */,
);
Expand Down

0 comments on commit 1c02a24

Please sign in to comment.