Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:M0ses:tmate
tmcs
_service:obs_scm:tmcs-0.0.3~git0.be87c37.obscpio
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:obs_scm:tmcs-0.0.3~git0.be87c37.obscpio of Package tmcs
07070100000000000081A4000001D9000001DA00000001607D4D7B000000AD000000000000000000000000000000000000002100000000tmcs-0.0.3~git0.be87c37/MakefilePREFIX ?= /usr/local INSTALL = install install: [ -d $(DESTDIR)$(PREFIX)/bin ] || mkdir -p $(DESTDIR)$(PREFIX)/bin $(INSTALL) -m 755 ./tmcs $(DESTDIR)$(PREFIX)/bin/tmcs 07070100000001000081A4000001D9000001DA00000001607D4D7B00000123000000000000000000000000000000000000002200000000tmcs-0.0.3~git0.be87c37/README.md# tmcs - The tmate configuration switcher ## Installation ``` sudo make install ``` or ``` PREFIX=$HOME make install ``` ## Usage ``` tmcs <profile> ``` ## Configuration Create an initial config: ``` # create initial config tmcs --init ``` and modify $HOME/.tmcs.yml to your needs 07070100000002000081ED000001D9000001DA00000001607D4D7B00000871000000000000000000000000000000000000001D00000000tmcs-0.0.3~git0.be87c37/tmcs#!/usr/bin/perl use strict; use warnings; use File::Basename; use YAML; if ( ! @ARGV or @ARGV > 1 ) { print_usage(1); } my $profile = $ARGV[0]; if ($profile eq "--help" ) { print_usage(0); } my $cf_file = "$ENV{HOME}/.tmcs.yml"; if ($profile eq "--init" ) { create_tmc_yml(); } my $cfg = config($cf_file); my $rc_file = "$ENV{HOME}/.tmate.conf"; if ( ! $cfg->{$profile} ) { die "Profile '$profile' not found in '$cf_file'\n"; } my $out; if ( $cfg->{$profile}->{conf_url} ) { $out = get_from_url($cfg->{$profile}->{conf_url}); } else { for my $i (qw/host port rsa-fingerprint ed25519-fingerprint/) { if ( $cfg->{$profile}->{$i} ) { $out .= sprintf("set -g tmate-server-%s \"%s\"\n", $i, $cfg->{$profile}->{$i}); } } } open(CFG,'>',$rc_file) || die "Could not open '$rc_file': $!\n"; print CFG $out; close CFG; sub print_usage { printf("Switch fast between your tmate configurations Usage: %s <profile|--help|--init> " , [split('/',$0)]->[-1]); exit $_[0]; } sub get_from_url { require LWP::UserAgent; my $ua = LWP::UserAgent->new; $ua->timeout(10); $ua->env_proxy; my $response = $ua->get($_[0]); if ($response->is_success) { return $response->decoded_content; # or whatever } else { die "Could not get from url '$_[0]':\n" . $response->status_line."\n"; } } sub config { my ($cfg) = @_; open(CFG,'<',$cfg) || die "Could not open '$cfg': $!\n"; { local $/; my $content = <CFG>; close CFG; return Load($content); } } sub create_tmc_yml { my $yml = $cf_file; ( -f $yml ) && die "File '$yml' already exists!\n"; my @lines = <DATA>; open(FH,">",$yml) || die "Could not open '$yml': $!"; map { print FH $_ } @lines; close FH; exit 0 } __DATA__ ################################################################################ # # EXAMPLE $HOME/.tmcs.yml # # Use e.g. # # tmcs home # # tmcs io # ################################################################################ home: conf_url: https://www.yourdomain.com/tmate.conf io: host: ssh.tmate.io port: 22 rsa-fingerprint: af:2d:81:c1:fe:49:70:2d:7f:09:a9:d7:4b:32:e3:be 07070100000003000081A4000001D9000001DA00000001607D4D7B0000055B000000000000000000000000000000000000002200000000tmcs-0.0.3~git0.be87c37/tmcs.spec# # spec file for package tmcs # # Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed # upon. The license for this file, and modifications and additions to the # file, is the same license as for the pristine package itself (unless the # license for the pristine package is not an Open Source License, in which # case the license is the MIT License). An "Open Source License" is a # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. # Please submit bugfixes or comments via http://bugs.opensuse.org/ # Name: tmcs Version: 0.0.1 Release: 0 Summary: The tmate configuration switcher License: GPL-3.0 Group: Productivity/Networking/Other Url: https://github.com/M0ses/tmcs.git Source: %{name}-%{version}.tar.xz #BuildRequires: BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildArch: noarch Requires: perl(YAML) Requires: perl(File::Basename) Recommends: perl(LWP::UserAgent) %description tmcs - The tmate configuration switcher %prep %setup -q %build %install %make_install PREFIX=%{_prefix} DESTDIR=%{buildroot} %files %defattr(-,root,root) %doc README.md /usr/bin/tmcs %changelog 07070100000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000B00000000TRAILER!!!10 blocks
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor