Skip to content
This repository has been archived by the owner on Jun 2, 2022. It is now read-only.

Commit

Permalink
App w/cli
Browse files Browse the repository at this point in the history
  • Loading branch information
hrbrmstr committed Feb 17, 2022
1 parent 7e34218 commit d81d9e0
Show file tree
Hide file tree
Showing 6 changed files with 160 additions and 12 deletions.
39 changes: 37 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,40 @@
# RSwitch
# RSwitch — Menubar and command-line utility to switch R versions on macOS

The next iteration of RSwitch (macOS 11+)

![](img/rswitch.png)
![](img/rswitch.png)

## Installing the CLI tool

```bash
ln -s /Applications/RSwitch.app/Contents/SharedSupport/rswitch-cli /usr/local/bin/rswitch
````

## Using the CLI tool

```
USAGE: r-switch [<vers>] [--arch <arch>] [--silent]

ARGUMENTS:
<vers> R version. e.g. 4.1

OPTIONS:
-a, --arch <arch> Architecture. arm64|x86_64. Defaults to system architecture.
-s, --silent No output after performing the switch.
-h, --help Show help information.
```
Example:
```bash
$ rswitch 4.1
R version 4.1.2 (2021-11-01) -- "Bird Hippie"
Copyright (C) 2021 The R Foundation for Statistical Computing
Platform: aarch64-apple-darwin20 (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under the terms of the
GNU General Public License versions 2 or 3.
For more information about these matters see
https://www.gnu.org/licenses/.
```
26 changes: 25 additions & 1 deletion RSwitch.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
objects = {

/* Begin PBXBuildFile section */
0146075C27BE8AB0001C5E64 /* rswitch-cli in CopyFiles */ = {isa = PBXBuildFile; fileRef = 0146075B27BE8AB0001C5E64 /* rswitch-cli */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
0147150427BD4FB900982AE7 /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0147150327BD4FB900982AE7 /* main.swift */; };
0147150A27BD517800982AE7 /* ArgumentParser in Frameworks */ = {isa = PBXBuildFile; productRef = 0147150927BD517800982AE7 /* ArgumentParser */; };
0147150C27BD557D00982AE7 /* RVersions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0147150B27BD557D00982AE7 /* RVersions.swift */; };
Expand All @@ -27,6 +28,16 @@
/* End PBXBuildFile section */

/* Begin PBXCopyFilesBuildPhase section */
0146075627BE83B9001C5E64 /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 12;
files = (
0146075C27BE8AB0001C5E64 /* rswitch-cli in CopyFiles */,
);
runOnlyForDeploymentPostprocessing = 0;
};
014714FF27BD4FB900982AE7 /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
Expand All @@ -39,6 +50,8 @@
/* End PBXCopyFilesBuildPhase section */

/* Begin PBXFileReference section */
0146075827BE8630001C5E64 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
0146075B27BE8AB0001C5E64 /* rswitch-cli */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.executable"; name = "rswitch-cli"; path = "DerivedData/RSwitch/Build/Products/Release/rswitch-cli"; sourceTree = "<group>"; };
0147150127BD4FB900982AE7 /* rswitch-cli */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "rswitch-cli"; sourceTree = BUILT_PRODUCTS_DIR; };
0147150327BD4FB900982AE7 /* main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = "<group>"; };
0147150B27BD557D00982AE7 /* RVersions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RVersions.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -85,13 +98,15 @@
children = (
0147150327BD4FB900982AE7 /* main.swift */,
0147150B27BD557D00982AE7 /* RVersions.swift */,
0146075827BE8630001C5E64 /* Info.plist */,
);
path = "rswitch-cli";
sourceTree = "<group>";
};
A70B6227237AF87000A2BA73 = {
isa = PBXGroup;
children = (
0146075B27BE8AB0001C5E64 /* rswitch-cli */,
A70B6232237AF87000A2BA73 /* RSwitch */,
A70B6231237AF87000A2BA73 /* Products */,
);
Expand Down Expand Up @@ -184,6 +199,7 @@
A70B622C237AF87000A2BA73 /* Sources */,
A70B622D237AF87000A2BA73 /* Frameworks */,
A70B622E237AF87000A2BA73 /* Resources */,
0146075627BE83B9001C5E64 /* CopyFiles */,
);
buildRules = (
);
Expand All @@ -204,7 +220,7 @@
attributes = {
BuildIndependentTargetsInParallel = YES;
LastSwiftUpdateCheck = 1330;
LastUpgradeCheck = 1220;
LastUpgradeCheck = 1330;
ORGANIZATIONNAME = "Golden Chopper";
TargetAttributes = {
0147150027BD4FB900982AE7 = {
Expand Down Expand Up @@ -296,12 +312,15 @@
isa = XCBuildConfiguration;
buildSettings = {
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = CBY22P58G8;
ENABLE_HARDENED_RUNTIME = YES;
INFOPLIST_FILE = "$(SRCROOT)/RSwitch/rswitch-cli/Info.plist";
MACOSX_DEPLOYMENT_TARGET = 11.0;
PRODUCT_BUNDLE_IDENTIFIER = "is.rud.rswitch-cli";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 5.0;
};
name = Debug;
Expand All @@ -310,12 +329,15 @@
isa = XCBuildConfiguration;
buildSettings = {
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = CBY22P58G8;
ENABLE_HARDENED_RUNTIME = YES;
INFOPLIST_FILE = "$(SRCROOT)/RSwitch/rswitch-cli/Info.plist";
MACOSX_DEPLOYMENT_TARGET = 11.0;
PRODUCT_BUNDLE_IDENTIFIER = "is.rud.rswitch-cli";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 5.0;
};
name = Release;
Expand Down Expand Up @@ -475,12 +497,14 @@
ENABLE_HARDENED_RUNTIME = YES;
ENABLE_PREVIEWS = YES;
INFOPLIST_FILE = RSwitch/Info.plist;
INFOPLIST_KEY_NSHumanReadableCopyright = "Copyright © 2022 Bob Rudis";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 11.0;
MARKETING_VERSION = 3.1.0b;
ONLY_ACTIVE_ARCH = NO;
PRODUCT_BUNDLE_IDENTIFIER = is.rud.rswitch;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down
10 changes: 5 additions & 5 deletions RSwitch.xcodeproj/xcshareddata/xcschemes/RSwitch.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1220"
LastUpgradeVersion = "1330"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down Expand Up @@ -31,9 +31,9 @@
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
buildConfiguration = "Release"
selectedDebuggerIdentifier = ""
selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down Expand Up @@ -69,7 +69,7 @@
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
buildConfiguration = "Release">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
Expand Down
78 changes: 78 additions & 0 deletions RSwitch.xcodeproj/xcshareddata/xcschemes/rswitch-cli.xcscheme
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1330"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "0147150027BD4FB900982AE7"
BuildableName = "rswitch-cli"
BlueprintName = "rswitch-cli"
ReferencedContainer = "container:RSwitch.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Release"
selectedDebuggerIdentifier = ""
selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "0147150027BD4FB900982AE7"
BuildableName = "rswitch-cli"
BlueprintName = "rswitch-cli"
ReferencedContainer = "container:RSwitch.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "0147150027BD4FB900982AE7"
BuildableName = "rswitch-cli"
BlueprintName = "rswitch-cli"
ReferencedContainer = "container:RSwitch.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Release">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
5 changes: 1 addition & 4 deletions RSwitch/RSwitch.entitlements
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
<?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>com.apple.security.automation.apple-events</key>
<true/>
</dict>
<dict/>
</plist>
14 changes: 14 additions & 0 deletions RSwitch/rswitch-cli/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?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>LSMinimumSystemVersion</key>
<string>11.0</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleSupportedPlatforms</key>
<string>MacOSX</string>
<key>CFBundleIdentifier</key>
<string>is.rud.rswitch-cli</string>
</dict>
</plist>

0 comments on commit d81d9e0

Please sign in to comment.