Giter VIP home page Giter VIP logo

deno-opn's Introduction

Deno Opn

A port of OPN



Badge LicenseBadge PortBadge Opn



Usage


Import

Latest

Use the bleeding edge.

import { open } from 'https://github.com/hashrock/deno-opn/raw/master/mod.ts'
Version

Use a specific Release tag.

import { open } from 'https://github.com/hashrock/deno-opn/raw/<Version Tag>/mod.ts'

v2.0.0

import { open } from 'https://github.com/hashrock/deno-opn/raw/v2.0.0/mod.ts'

v1.1.1(legacy)

import { opn } from 'https://github.com/hashrock/deno-opn/raw/v1.1.1/opn.ts'

File

Open a file with the default image viewer.

await open('unicorn.png');

URL

Open a URL in the default browser.

await open('http://sindresorhus.com');

With

Open the target with a specific program.

await open('http://sindresorhus.com',{ 
    with: [ 'firefox' ] 
});

Arguments

Supply the program with arguments.

await open('http://sindresorhus.com',{
    with: [ 'chrome' , '--incognito' ]
});


Design

Internally system specific commands
are used to start the child processes.


System Command
Badge Linux gio open
Badge MacOS start
Badge Windows open


Contributions

PRs welcome :)


deno-opn's People

Contributors

electronicsarchiver avatar hashrock avatar sdimkov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

deno-opn's Issues

WSL Support

The original opn can determine that it is itself running from the WSL.

Deno can't do that because of:

  • "platform" in WSL returns just { arch: "x64", os: "linux" }
  • there is no os.release().

Smoke test

We might not do much testing on GitHub Actions(Linux CLI), but at least we can see if the deno execution passes.

Documentation Suggestions

I saw that you use GitHub Pages now,
unfortunately there are some problems
with markdown as you might have noticed.

https://hashrock.github.io/deno-opn/

How about moving the documentation that
is present in the README and the example
from the /Documentation/ folder into
a dedicated branch called Documentation
with the root as it's entry point?

Reformat

use deno fmt to conform to deno convention.

doesn't work on deno/linux

if i start the most simple example utilizing your code by deno 0.35.0 on debian linux;

import { opn } from 'https://denopkg.com/hashrock/deno-opn/opn.ts';
opn('https://example.com');

i'll only get this error reports:

error TS2339: Property 'platform' does not exist on type 'typeof Deno'.

► https://raw.githubusercontent.com/hashrock/deno-opn/master/opn.ts:1:14

1 const { run, platform } = Deno;
               ~~~~~~~~

error TS2532: Object is possibly 'undefined'.

► https://raw.githubusercontent.com/hashrock/deno-opn/master/opn.ts:34:19

34   const appArgs = optsWithDefault.app.slice(1);
                     ~~~~~~~~~~~~~~~~~~~

error TS2532: Object is possibly 'undefined'.

► https://raw.githubusercontent.com/hashrock/deno-opn/master/opn.ts:35:39

35   const openApp: string | undefined = optsWithDefault.app[0];
                                         ~~~~~~~~~~~~~~~~~~~


Found 3 errors.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.