Skip to content

Commit

Permalink
init project
Browse files Browse the repository at this point in the history
  • Loading branch information
yujinqiu committed Sep 15, 2020
0 parents commit 775aa3d
Show file tree
Hide file tree
Showing 9 changed files with 484 additions and 0 deletions.
46 changes: 46 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
### 工具干什么用
用来快速在命令行中复制文件, 这样就可以可以在 Evernote, Mail 等上粘贴图片/PDF 等文件

![showcase](./demo/showcase.gif)

### 为什么写这个工具

本人的很多工作严重依赖命令行工具, 比如有人在微信上你要一个文件在`/Users/foo/Downloads/bar.png`常见的工作流是

1. 快速进入一个目录: `j Downloads`
2. 找到`bar.png`
3. 在没有 `pbadd` 工具的时候, 需要 `open .` 然后 `Command + c` 然后切换到 Evernote 上 `Command + v`

使用 `open` 的问题是如果文件很多的话, 还需要在 Finder 中搜索一下:-(

有了 `pbadd` 之后的工作流

1. 快速进入一个目录: `j Downloads`
2. `pbadd foo.png` 然后切换到 Evenote 上 `Command + v` 😊

[V2ex](https://v2ex.com/t/700647) 上发现有人有类似的问题, 但是帖子中的 Applescript 只能添加一个文件, 而且不能支持相对路径

我想要一个可以支持**批量文件**和不需要考虑(相对/绝对)路径的复制工具(Let computer do the thing)

所以就自己写个这个简单工具

### 安装

1. 下载 `pbadd` 二进制文件到系统 PATH (比如 `/usr/local/bin`) 中
2. 设置可执行权限 `chmod 0755 /usr/local/bin/pbadd`


### 用法
```
pbadd file1 file2 ... fileN
```
然后就可以开心去 Evernote 等 `Command + v` 😊
会自动判断文件是否存在, 不存在文件会被自动过忽略

### 和pbcopy 有什么区别

`pbcopy` 是读取**文件内容**, 这样在粘贴的时候只是对应的内容

`pbadd` 是复制**文件本身**, 可以在粘贴文件本身, 而不是内容


Binary file added demo/showcase.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
317 changes: 317 additions & 0 deletions pbadd.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,317 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 52;
objects = {

/* Begin PBXBuildFile section */
DE974DA525104A2700BD190D /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE974DA425104A2700BD190D /* main.swift */; };
DEE0B1FF2510545D00807DBF /* ArgumentParser in Frameworks */ = {isa = PBXBuildFile; productRef = DEE0B1FE2510545D00807DBF /* ArgumentParser */; };
/* End PBXBuildFile section */

/* Begin PBXCopyFilesBuildPhase section */
DE974D9F25104A2700BD190D /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = /usr/share/man/man1/;
dstSubfolderSpec = 0;
files = (
);
runOnlyForDeploymentPostprocessing = 1;
};
/* End PBXCopyFilesBuildPhase section */

/* Begin PBXFileReference section */
DE974DA125104A2700BD190D /* pbadd */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = pbadd; sourceTree = BUILT_PRODUCTS_DIR; };
DE974DA425104A2700BD190D /* main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
DE974D9E25104A2700BD190D /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
DEE0B1FF2510545D00807DBF /* ArgumentParser in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
DE974D9825104A2700BD190D = {
isa = PBXGroup;
children = (
DE974DA325104A2700BD190D /* pbadd */,
DE974DA225104A2700BD190D /* Products */,
);
sourceTree = "<group>";
};
DE974DA225104A2700BD190D /* Products */ = {
isa = PBXGroup;
children = (
DE974DA125104A2700BD190D /* pbadd */,
);
name = Products;
sourceTree = "<group>";
};
DE974DA325104A2700BD190D /* pbadd */ = {
isa = PBXGroup;
children = (
DE974DA425104A2700BD190D /* main.swift */,
);
path = pbadd;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
DE974DA025104A2700BD190D /* pbadd */ = {
isa = PBXNativeTarget;
buildConfigurationList = DE974DA825104A2700BD190D /* Build configuration list for PBXNativeTarget "pbadd" */;
buildPhases = (
DE974D9D25104A2700BD190D /* Sources */,
DE974D9E25104A2700BD190D /* Frameworks */,
DE974D9F25104A2700BD190D /* CopyFiles */,
);
buildRules = (
);
dependencies = (
);
name = pbadd;
packageProductDependencies = (
DEE0B1FE2510545D00807DBF /* ArgumentParser */,
);
productName = pbadd;
productReference = DE974DA125104A2700BD190D /* pbadd */;
productType = "com.apple.product-type.tool";
};
/* End PBXNativeTarget section */

/* Begin PBXProject section */
DE974D9925104A2700BD190D /* Project object */ = {
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 1200;
LastUpgradeCheck = 1200;
TargetAttributes = {
DE974DA025104A2700BD190D = {
CreatedOnToolsVersion = 12.0;
};
};
};
buildConfigurationList = DE974D9C25104A2700BD190D /* Build configuration list for PBXProject "pbadd" */;
compatibilityVersion = "Xcode 9.3";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = DE974D9825104A2700BD190D;
packageReferences = (
DEE0B1FD2510545D00807DBF /* XCRemoteSwiftPackageReference "swift-argument-parser" */,
);
productRefGroup = DE974DA225104A2700BD190D /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
DE974DA025104A2700BD190D /* pbadd */,
);
};
/* End PBXProject section */

/* Begin PBXSourcesBuildPhase section */
DE974D9D25104A2700BD190D /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
DE974DA525104A2700BD190D /* main.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */

/* Begin XCBuildConfiguration section */
DE974DA625104A2700BD190D /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
};
name = Debug;
};
DE974DA725104A2700BD190D /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = macosx;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
};
name = Release;
};
DE974DA925104A2700BD190D /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = H54RTM28PH;
ENABLE_HARDENED_RUNTIME = YES;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
};
name = Debug;
};
DE974DAA25104A2700BD190D /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = H54RTM28PH;
ENABLE_HARDENED_RUNTIME = YES;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
};
name = Release;
};
/* End XCBuildConfiguration section */

/* Begin XCConfigurationList section */
DE974D9C25104A2700BD190D /* Build configuration list for PBXProject "pbadd" */ = {
isa = XCConfigurationList;
buildConfigurations = (
DE974DA625104A2700BD190D /* Debug */,
DE974DA725104A2700BD190D /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
DE974DA825104A2700BD190D /* Build configuration list for PBXNativeTarget "pbadd" */ = {
isa = XCConfigurationList;
buildConfigurations = (
DE974DA925104A2700BD190D /* Debug */,
DE974DAA25104A2700BD190D /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */

/* Begin XCRemoteSwiftPackageReference section */
DEE0B1FD2510545D00807DBF /* XCRemoteSwiftPackageReference "swift-argument-parser" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/apple/swift-argument-parser.git";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 0.3.1;
};
};
/* End XCRemoteSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
DEE0B1FE2510545D00807DBF /* ArgumentParser */ = {
isa = XCSwiftPackageProductDependency;
package = DEE0B1FD2510545D00807DBF /* XCRemoteSwiftPackageReference "swift-argument-parser" */;
productName = ArgumentParser;
};
/* End XCSwiftPackageProductDependency section */
};
rootObject = DE974D9925104A2700BD190D /* Project object */;
}
7 changes: 7 additions & 0 deletions pbadd.xcodeproj/project.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"object": {
"pins": [
{
"package": "swift-argument-parser",
"repositoryURL": "https://github.com/apple/swift-argument-parser.git",
"state": {
"branch": null,
"revision": "92646c0cdbaca076c8d3d0207891785b3379cbff",
"version": "0.3.1"
}
}
]
},
"version": 1
}
Binary file not shown.
Loading

0 comments on commit 775aa3d

Please sign in to comment.